Open RazrFalcon opened 6 years ago
A few times now I've written an option that I wanted to turn into a Box<Read>
/ Box<Write>
depending on whether a filename or a "-" was passed on the command line. It'd be neat if StructOpt or something could detect that (I have no idea between quicli and structopt where that responsibility would lie).
#[derive(Debug, StructOpt)]
struct Cli {
#[structopt(short="o")]
output: Box<Write>,
}
And then have myprog
, myprog -o -
turn into a boxed Stdout writer, and myprog -o somefile
turn into a boxed File writer. Similarly readers/reader-writers depending on what traits you ask for in the box.
It will be great if I could just set some flag and callback to get an ability to read from stdin and write to stdout.