quicli icon indicating copy to clipboard operation
quicli copied to clipboard

Unix pipes support out of the box

Open RazrFalcon opened this issue 8 years ago • 1 comments

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.

RazrFalcon avatar Mar 27 '18 12:03 RazrFalcon

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.

archaelus avatar Oct 11 '18 15:10 archaelus