mithrandie / csvq

SQL-like query language for csv
https://mithrandie.github.io/csvq
MIT License
1.51k stars 63 forks source link

feature request : set output format from file extension #76

Closed kpym closed 2 years ago

kpym commented 2 years ago

I know that we can specify the output format with -f flag, but if we run

 csvq -o "test.json" 'select * from `test.csv`'

the resulting test.json file is in text format not in json, as the default output format is always text. It will be nice if the default format depends on the specified output :

Thanks for your work on this fantastic tool 🙏

mithrandie commented 2 years ago

In version 1.17.1, when the --format option is not specified, the file specified by the --out option will be output in a specific format if it has the following extensions.

file extension format
.csv CSV
.tsv TSV
.json JSON
.jsonl JSON Lines
.ltsv LTSV
.md GFM
.org ORG
ktzanev commented 2 years ago

Thanks for considering my request !