Which command-line tool convention is best? Kind of assuming B, for pipe-ability? If B, how do I feet a Rust CLI to do that?


oh dang, one of my Rust CLIs just works with `fgift input_file.csv > output.txt`.



· · Web · 3 · 0 · 0

OK here's where I'm at:

I want my Rust CLI to accept input from stdin (a pipe?) OR the traditional way (`foo -abc input.txt`)

But I also use StructOpt[1]... which might be too strict for this kind of thing?

(1) github.com/TeXitoi/structopt

here's how I adapted another one of my Rust CLIs to print to standard output (just println!)


Think it's a decent solution? Need to test it a bit more though.

@schlink the ">" is the output redirection operator of the shell, so it will work with anything written to the standard output (file descriptor 0).

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!