We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
=
--name string
--name=string
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
Issue by pnkfelix Thursday May 15, 2014 at 08:12 GMT
For earlier discussion, see rust-lang/rust#14223
This issue was labelled with: A-libs in the Rust repository
Sample program:
extern crate getopts; use getopts::{optopt,optflagopt,getopts}; use std::os; fn main() { let args = os::args(); let opts = [optopt( "o", "output", "set output file name", "NAME"), optflagopt("a", "attrib", "set attribute", "KEY=VALUE")]; let matches = match getopts(args.tail(), opts) { Ok(m) => { m } Err(f) => { fail!(f.to_err_msg()) } }; let output = matches.opt_str("o"); let keyval = matches.opt_str("a"); println!("output: {}", output); println!("attrib: {}", keyval); }
Here is a transcript illustrating some interesting invocations
% rustc /tmp/g.rs % ./g --output=hm output: Some(hm) attrib: None % ./g --attrib output: None attrib: None % ./g --attrib hi output: None attrib: Some(hi) % ./g --attrib hi=world output: None attrib: Some(hi=world) % ./g -a=hi=world output: None attrib: Some(=hi=world) % ./g -a hi=world output: None attrib: Some(hi=world) % ./g --attrib=hi=world output: None attrib: Some(hi) %
I think that --attrib hi=world and --attrib=hi=world should be treated as equivalent inputs.
--attrib hi=world
--attrib=hi=world
From skimming getopts, this should be relatively easy to fix by replacing the call to split('=') with splitn('=', 1).
split('=')
splitn('=', 1)
The text was updated successfully, but these errors were encountered:
handle '=' in arguments more nicely
8ec916b
Now "--arg=A=B" and "--arg A=B" are equivalent. Fixes rust-lang#14.
No branches or pull requests
Thursday May 15, 2014 at 08:12 GMT
For earlier discussion, see rust-lang/rust#14223
This issue was labelled with: A-libs in the Rust repository
Sample program:
Here is a transcript illustrating some interesting invocations
I think that
--attrib hi=world
and--attrib=hi=world
should be treated as equivalent inputs.From skimming getopts, this should be relatively easy to fix by replacing the call to
split('=')
withsplitn('=', 1)
.The text was updated successfully, but these errors were encountered: