Expansion of CLI Options

Hello VisiDaters!

Recently, Saul has pushed a re-work of the CLI options to the develop branch. I am particularly excited about this change, and so I wanted to cover it in detail.

I am going to be referencing two options; -f, alias for --filetype, and -d, alias for --delimiter.

By default, VisiData deduces the filetype of a source from its extension. -f allows you to manually declare the filetype, overriding deduction by extension. -d sets the delimiter for TSV files.

The Additions

Historically, if you did,

vd -f csv foo.tsv bar.csv

the option -f would then get applied as a global option to every source. There was no way to communicate to VisiData distinct filetypes for each source.

With the new additions, you can do this,

vd -f tsv foo.tsv -f csv bar.csv

Now, -f tsv would be applied to foo.tsv, and -f csv would be applied to bar.csv.

How Sheet-Specific CLI Options Work

Examples:

To specify a different delimiter for each file,

vd -d '|' pipes.tsv -d ',' commas.tsv

To set a global delimiter,

vd pipes.tsv commas.tsv -g -d '|'
vd -g -d '|' pipes.tsv commas.tsv

To specify a filetype for all of the files provided through the CLI,

vd foo bar -f tsv

Limitations

As always, please let us know how you feel about it! Share a tweet, or stop by for a chat in freenode #visidata.

[written by Anja Boskovic 2020-07-07][updated by Anja Boskovic 2020-07-26]