-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for -- arguments #25
Comments
Actually, that doesn't work either because
|
I can remove the |
Oh! Instead, I can use |
I ended up with this: let mut args: Vec<_> = std::env::args_os().collect();
args.remove(0);
/* this bit is `deadlinks` specific
if args.get(0).map_or(true, |arg| arg != "deadlinks") {
return Err(Error::ArgumentParsingFailed { cause: "cargo-deadlinks should be run as `cargo deadlinks`".into() });
}
args.remove(0);
*/
let cargo_args = if let Some(dash_dash) = args.iter().position(|arg| arg == "--") {
let c = args.drain(dash_dash+1..).collect();
args.pop();
c
} else {
Vec::new()
}; |
Yes, I guess Also, I have no idea how I would say adding a usage example for |
I want to have arguments like this:
Right now I have to call
free()
and manually parse the arguments. It would be nice to have built-in support for this. I'm imaginingArguments::dash_dash() -> (Vec<String>, Option<Vec<String>>)
(or maybe just(Vec<String>, Vec<String>)
for simplicity). It would behave likefree()
except that it parses out the--
for you.The text was updated successfully, but these errors were encountered: