Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature request: ignore unspecified arguments #8
Comments
This comment has been minimized.
This comment has been minimized.
|
I don't parse command line, I just forward all that to https://crates.io/crates/clap and I can't find this feature in clap. Maybe a workaround is to get the generated clap object, add the arguments you want to ignore, and then parse. Something like that (not tested) #[derive(StructOpt, PartialEq, Debug)]
struct Opt {
#[structopt(short = "d", long = "debug")]
debug: bool,
}
let app = Opt::clap().arg(Arg::with_name("v").short("v").long("verbose").help("Not implemented"));
let opt = Opt::from_clap(app.get_matches());And thanks for the feedback! |
TeXitoi
closed this
Mar 15, 2017
TeXitoi
added
the
question
label
Feb 24, 2018
pushed a commit
to Eijebong/structopt
that referenced
this issue
Jan 2, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
m4b commentedFeb 27, 2017
This is a somewhat unusual request so if this isn't in your immediate plans, or ever, feel free to close. But I would be very happy to see it.
But the gist is I'd like to be able to have a sort of "non strictness mode" perhaps configured via builder, etc., which ignores any arguments which aren't spec'd by the argument struct.
Reason: I'm writing a tool that is a drop in replacement for another tool, and I want it to not die when it receives an argument it doesn't understand. This will allow me to incrementally implement certain features or choose to die on some flags (by implementing them), etc.
Is this something that's possible ?
Regardless awesome crate, already using it here, was painless to covert from basic toy arg iterator, I think you've got one of the nicest arg crates around at this point :)👍