Commit graph

1161 commits

Author SHA1 Message Date
Homu
700db3f9b1 Auto merge of #409 - cstorey:master, r=kbknapp
Allow for more than 256 occurrences of an argument.

Hi,

I often use tools with `xargs` and the like, and it's entirely possible to end up with inhumanly long sets of parameters being passed to a command.

Without this fix, the library will panic with an arithmetic overflow in `ArgMatcher#inc_occurrence_of` when the 256th instance of the parameter is accounted for.

Thanks,
2016-02-03 05:08:36 +09:00
Ceri Storey
f86a183e32 chore: Add myself to contributors. 2016-02-02 19:32:11 +00:00
Ceri Storey
3731ddb361 fix(matched_arg): Allow for more than 256 occurrences of an argument. 2016-02-02 19:30:32 +00:00
Kevin K
dbea0e349b chore: increase version 2016-02-02 07:45:49 -05:00
Kevin K
07dfdd00ea tests(multiples): adds tests for > u8::max vals and occurrences 2016-02-02 07:45:49 -05:00
Kevin K
c19a791745 imp(values): adds support for up to u64::max values per arg 2016-02-02 07:45:49 -05:00
Kevin K
d431417003 refactor(macros): does some code deduplication by macros 2016-02-02 07:45:49 -05:00
Kevin K
2704b300ec refactor(macros): implements a slightly better arg_post_processing 2016-02-02 07:45:49 -05:00
Kevin K
8f145f1024 refactor(macros): implements a better _handle_group_reqs 2016-02-02 07:45:49 -05:00
Kevin K
de32078d75 refactor(macros): implements a better vec_remove and remove_overriden 2016-02-02 07:45:49 -05:00
Kevin K
ca7f197a12 refactor: minor code cleanup 2016-02-02 07:45:49 -05:00
Kevin K
7596951a30 tests: adds additional tests for new setting and missing old tests 2016-02-02 07:21:01 -05:00
Kevin K
cdee7a0eb2 feat(AppSettings): adds HidePossibleValuesInHelp to skip writing those values 2016-02-02 07:21:01 -05:00
Kevin K
be2cbd9480 fix(App::args_from_usage): skips empty lines when parsing multiple lines from usage 2016-02-02 07:21:01 -05:00
Kevin K
ee96baffd3 fix(value_t_or_exit): fixes typo which causes value_t_or_exit to return a Result 2016-02-02 07:21:01 -05:00
Homu
bc091c4a78 Auto merge of #407 - kbknapp:fixrollup, r=kbknapp
Fixrollup
2016-02-01 15:25:21 +09:00
Kevin K
2564b3af11 chore: increase version 2016-01-31 08:23:34 -05:00
Kevin K
ab41be700b imp(arg_enum): enum declared with arg_enum returns [&'static str; #] instead of Vec 2016-01-31 08:23:34 -05:00
Kevin K
4735f4d5cb tests(SubCommands): adds tests for subcmds after mult args 2016-01-31 07:37:20 -05:00
Kevin K
c19c17a885 fix(SubCommands): fixed where subcmds weren't recognized after mult args
Closes #405
2016-01-31 07:35:42 -05:00
Kevin K
816cec8152 tests(Usage Parser): moves tests usage parser since that's what it's testing 2016-01-31 07:12:15 -05:00
Kevin K
0bcc712064 fix(Usage Parser): fixes a bug where literal single quotes weren't allowed in help strings
Closes #406
2016-01-31 07:12:07 -05:00
Homu
f50b8dbf98 Auto merge of #404 - Keats:fix-macro, r=Vinatorul
fix: clap_app! should be gated by unstable, not nightly feature

Should fix #402
2016-01-30 22:02:33 +09:00
Vincent Prouillet
0c8b84af61 fix: clap_app! should be gated by unstable, not nightly feature 2016-01-30 11:16:13 +00:00
Homu
3067a12cab Auto merge of #403 - kbknapp:cargo-features, r=kbknapp
fix: fixes cargo features to NOT require nightly with unstable features
2016-01-30 19:42:38 +09:00
Kevin K
998b0dfce0 chore: increase version 2016-01-29 22:11:34 -05:00
Kevin K
280ada7b84 fix: fixes cargo features to NOT require nightly with unstable features
Closes #402
2016-01-29 22:11:34 -05:00
Homu
7b287d7335 Auto merge of #399 - kbknapp:rebase-v2, r=kbknapp
clap v2

Finally ready...
2016-01-29 23:41:55 +09:00
Kevin K
90542747ac chore: fixes doc and style mistakes 2016-01-28 21:58:40 -05:00
Homu
0b2a8a296f Auto merge of #397 - Geogi:bump-deps, r=kbknapp
chore: bump dependencies bitflags and yaml-rust to latest version

Bump `bitflags` from 0.3.3 to 0.4.0 and `yaml-rust` from 0.2.2 to 0.3.0.

All tests pass in current stable, beta and nightly (`1.8.0-nightly (38e23e8f7 2016-01-27)`).
2016-01-29 01:58:51 +09:00
Kevin K
bf8cd8f446 chore: increase version 2016-01-28 11:46:12 -05:00
Kevin K
d374fd4def chore: adds new contributors 2016-01-28 11:46:12 -05:00
Kevin K
4d7c5675b9 chore: updates dep-graph 2016-01-28 11:46:12 -05:00
Kevin K
c28d24db3e fix: fixes nightly build with new lints 2016-01-28 11:46:12 -05:00
Kevin K
d182049119 chore: fixes failing rustdoc 2016-01-28 11:46:12 -05:00
Kevin K
c13963a30d chore: updates appveyor build file 2016-01-28 11:46:12 -05:00
Kevin K
a210f89b84 docs: updates examples for 2x release
Closes #394
2016-01-28 11:46:12 -05:00
Kevin K
518b89bd3d fix: fixes Windows build for 2x release
Closes #392
2016-01-28 11:46:12 -05:00
Kevin K
f8692a0b3a docs: updates examples for 2x release
Closes #394
2016-01-28 11:46:12 -05:00
Kevin K
2031682193 chore: updates additional files for 2x release 2016-01-28 11:46:12 -05:00
Kevin K
d2a78e3e21 docs: updates documentation for v2 release 2016-01-28 11:45:31 -05:00
Kevin K
5f0da1200b docs(README.md): updates readme for v2 release
Closes #393
2016-01-28 11:45:31 -05:00
Kevin K
693aece2cb fix: fixes yaml build for 2x base 2016-01-28 11:45:31 -05:00
Kevin K
4c37b26a84 tests: fixes some failing doc tests 2016-01-28 11:45:31 -05:00
Kevin K
e494672ffc refactor: removes some unnecessary code checks 2016-01-28 11:45:31 -05:00
Kevin K
f1876388a7 docs: updating docs for 2x release 2016-01-28 11:45:31 -05:00
Kevin K
609c06e119 feat: adds support for external subcommands
External subcommands are now supported via the following:

```rust
extern crate clap;
use clap::{App, AppSettings};

fn main() {
    // Assume there is a third party subcommand named myprog-subcmd
    let m = App::new("myprog")
        .setting(AppSettings::AllowExternalSubcommands)
        .get_matches_from(vec![
            "myprog", "subcmd", "--option", "value", "-fff", "--flag"
        ]);
    // All trailing arguments will be stored under the subcommands sub-matches under a
    // value of their runtime name (in this case "subcmd")
    match m.subcommand() {
        (external, Some(ext_m)) => {
            let ext_args: Vec<&str> = ext_m.values_of(external).unwrap().collect();
            assert_eq!(ext_args ,["--option", "value", "-fff", "--flag"]);
        },
        _ => unreachable!()
   }
}
```

Closes #372
2016-01-28 11:45:31 -05:00
Kevin K
86f3e33975 refactor(macros): uses macros to implement Settings enums 2016-01-28 11:45:31 -05:00
Kevin K
26ecadd252 feat: adds support values with a leading hyphen
By using AppSettings::AllowLeadingHyphen values starting with a
leading hyphen (such as a negative number) are supported. This
setting should be used with caution as it silences certain
circumstances which would otherwise be an error (like forgetting
a value to an option argument).

Closes #385
2016-01-28 11:45:31 -05:00
Kevin K
474f27af43 tests: adds tests for values when delims have been turned off 2016-01-28 11:45:31 -05:00