These are chat archives for kbknapp/clap-rs

1st
Jun 2018
Josh Triplett
@joshtriplett
Jun 01 2018 17:17
@sarum90 Do you need to preserve compatibility with that exact command-line argument syntax, or do you just want to know how to do something equivalent?
It'd be relatively easy to implement a slightly different approach, in which --file-type came before --file and modified the current default, and each --file used the current default.
Josh Triplett
@joshtriplett
Jun 01 2018 17:22
If you want to keep the style you currently have, then you'd likely need a more stateful approach: --file saves the last file received in a variable, and --file-type modifies the type of that last file, and each time you get a new file or you reach the end of the arguments, take the last file and its file type and stuff it in your list of files.