Commit graph

1748 commits

Author SHA1 Message Date
Kevin K
6edde30b8e
setting(AllowMissingPositional): allows one to implement $ prog [optional] <required>
Closes #636
2017-01-04 00:02:26 -05:00
Homu
ce083919be Auto merge of #804 - kbknapp:issues-801,694, r=kbknapp
Issues 801,694 and tests overhaul
2017-01-03 15:00:53 +09:00
Kevin K
2fc5acaff7
fixup! tests: adds tests for propogating values down 2017-01-02 23:10:46 -05:00
Kevin K
f967235a90
tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
Kevin K
c142fb544d
tests: adds tests for propogating values down 2017-01-02 23:05:50 -05:00
Kevin K
985536c8eb
setting(PropagateGlobalValuesDown): adds a setting to allow automatically propagating global args values down through *used* subcommands
Closes #694
2017-01-02 23:05:50 -05:00
Kevin K
20842ed8c2
fix: fixes an issue where the full help message wasn't written when doing App::write_help
Closes #801
2017-01-02 23:05:50 -05:00
Homu
8e942c2b31 Auto merge of #802 - kbknapp:issues-774,777, r=kbknapp
Issues 774,777
2017-01-03 09:24:51 +09:00
Kevin K
bffe636a01 Merge branch 'master' into issues-774,777 2017-01-02 16:46:51 -05:00
Kevin K
fc3800b830
tests: adds tests for wrapping meta help items 2017-01-02 16:44:40 -05:00
Kevin K
ad4691b71a
feat(Help Wrapping): long app names (with spaces), authors, and descriptions are now wrapped appropriately
Closes #777
2017-01-02 16:43:45 -05:00
Kevin K
1f33de5450
imp(Default Values): improves the error message when default values are involved
Closes #774
2017-01-02 16:43:07 -05:00
Homu
446ec981d1 Auto merge of #800 - kbknapp:issue-782-take2, r=kbknapp
Issue 782 take2
2017-01-03 05:59:45 +09:00
Kevin K
9c3cb9834c
bench: adds a bench with short circuiting some calls via ArgsNegateSubcommands 2017-01-02 14:38:17 -05:00
Kevin K
aa26a50d5c
tests: adds tests to guard against low index multiples with allow_hyphen_values failing 2017-01-02 14:34:25 -05:00
Kevin K
26c670ca16
fix(Low Index Multiples): fixes a bug which caused combinations of LowIndexMultiples and allow_hyphen_values to fail parsing 2017-01-02 14:33:56 -05:00
Kevin K
20a2d95ddf
chore: bumps term_size version 2017-01-02 12:23:03 -05:00
Kevin K
baff4200a4
refactor: implements BitOr for AppFlags to improve some ergonomics and performance 2017-01-02 12:23:03 -05:00
Kevin K
9d9683feb0
tests(Arg::value_terminator): adds tests for Arg::value_termintaor 2017-01-02 12:23:03 -05:00
Kevin K
be64ce0c37
api(Arg::value_terminator): adds the ability to terminate multiple values with a given value
One can now specificy a value termintaor that will stop the parsing of multiple values upon
reaching this special value.

Closes #782
2017-01-02 12:23:03 -05:00
Homu
3ca4a08f0f Auto merge of #798 - nabijaczleweli:feat/778-simple-cargo-app, r=kbknapp
Implement crate_description!, crate_name! and app_from_crate! macros

Includes documentation.
2017-01-01 07:04:16 +09:00
nabijaczleweli
4d9a82db8e
feat(simple-cargo-app): Implement crate_description!, crate_name! and app_from_crate! macros
Closes #778
2016-12-31 14:25:59 +01:00
Homu
805b9b65a3 Auto merge of #797 - kbknapp:three-new-settings-and-a-fix, r=kbknapp
Three new settings and a fix
2016-12-31 14:21:31 +09:00
Kevin K
12026f63d9
tests: adds tests for 2016-12-30 23:22:09 -05:00
Kevin K
5e2af8c96a
setting: adds a setting to disable args being allowed between subcommands (ArgsNegateSubcommands)
Specifies that use of a valid [argument] negates [subcomands] being used after. By default
`clap` allows arguments between subcommands such as
`<cmd> [cmd_args] <cmd2> [cmd2_args] <cmd3> [cmd3_args]`. This setting disables that
functionality and says that arguments can only follow the *final* subcommand. For instance
using this setting makes only the following invocations possible:

* `<cmd> <cmd2> <cmd3> [cmd3_args]`
* `<cmd> <cmd2> [cmd2_args]`
* `<cmd> [cmd_args]`

Closes #793
2016-12-30 23:21:28 -05:00
Kevin K
25cbca4e41
tests: adds tests for 2016-12-30 22:40:28 -05:00
Kevin K
c2978afc61
setting: adds a new setting to disable the collapsing of positional args into [ARGS] in the usage string (DontCollapseArgsInUsage)
Closes #769
2016-12-30 22:38:42 -05:00
Kevin K
945acffb5e
chore: bumps pinned nightly for clippy CI builds 2016-12-30 22:10:14 -05:00
Kevin K
c20701b74a
chore: clippy run 2016-12-30 22:08:28 -05:00
Kevin K
fabe9267ee
chore: updates deps and pins pre-1.0 crates 2016-12-30 22:03:36 -05:00
Kevin K
01caf84b87
tests(DisableHelpSubcommand): adds tests for AppSettings::DisableHelpSubcommand 2016-12-30 21:53:58 -05:00
Kevin K
a10fc859ee
setting: adds a setting to disable building the help subcommand (DisableHelpSubcommand)
Relates to #787
2016-12-30 21:52:45 -05:00
Kevin K
d34ec3e032
fix(Help Subcommand): fixes a bug where the help subcommand couldn't be overriden
Closes #787
2016-12-30 21:37:09 -05:00
Kevin K
85ea57835d
chore: updates the contributing instructions 2016-12-30 21:23:19 -05:00
Homu
7eb949ba38 Auto merge of #796 - kbknapp:issue-665, r=kbknapp
Issue 665
2016-12-31 07:48:07 +09:00
Kevin K
327c514d7a
test(Options): adds a test against issue 665 2016-12-30 16:25:48 -05:00
Kevin K
5a5f2b1e9f
fix(Options): fixes a critical bug where options weren't forced to have a value
For instance imagine --opt <val> and --opt2 <val>

Running:

```
$ prog --opt --opt2 val
```

Would pass. This has been fixed.

Closes #665
2016-12-30 16:17:47 -05:00
Homu
03f72335a9 Auto merge of #795 - kbknapp:issue-792, r=kbknapp
style: standardizes debug calls and output

Closes #792
2016-12-30 14:30:16 +09:00
Kevin K
988b9cbea4
style: standardizes debug calls and output
Closes #792
2016-12-29 23:34:46 -05:00
Homu
14a08e8619 Auto merge of #794 - kbknapp:issue-764, r=kbknapp
Issue 764
2016-12-30 01:57:11 +09:00
Kevin K
280bb85f69 Merge branch 'master' into issue-764 2016-12-28 23:58:11 -05:00
Kevin K
1c9e8700d4
chore: bumps version in prep for more commits 2016-12-28 23:57:13 -05:00
Kevin K
3055e77ea7
tests(YAML): adds some of the new APIs to the YAML tests 2016-12-28 23:56:33 -05:00
Kevin K
9a4df32789
imp(YAML): adds conditional requirements and conditional default values to YAML
All of the conditional default values and conditional requirements
(requried and requires) can now be used with YAML builders as well.

Closes #764
2016-12-28 23:34:29 -05:00
Kevin K
60e1a3a02b
tests(Conditionally Required): adds tests for conditionally required args 2016-12-28 23:30:52 -05:00
Kevin K
ee9cfddf34
feat(Conditionally Required): adds the ability for an arg to be conditionally required
An arg can now be conditionally required (i.e. it's only required if arg
A is used with a value of V).

For example:

```rust
let res = App::new("ri")
	.arg(Arg::with_name("cfg")
	    .required_if("extra", "val")
	    .takes_value(true)
	    .long("config"))
	.arg(Arg::with_name("extra")
	    .takes_value(true)
	    .long("extra"))
	.get_matches_from_safe(vec![
	    "ri", "--extra", "val"
	]);

assert!(res.is_err());
assert_eq!(res.unwrap_err().kind, ErrorKind::MissingRequiredArgument);
```

Relates to #764
2016-12-28 23:30:52 -05:00
Kevin K
4ef091019c
docs(Conditional Default Values): fixes the failing doc tests of Arg::default_value_ifs 2016-12-28 23:28:21 -05:00
Kevin K
7f296e29db
docs(Conditional Requirements): adds docs for Arg::requires_ifs 2016-12-28 23:28:21 -05:00
Kevin K
198449d643
feat(Conditional Requirements): adds the ability to conditionally require additional args
An arg can now conditionally require additional arguments if it's value matches a specific value.

For example, arg A can state that it only requires arg B if the value X was used with arg A. If any
other value is used with A, arg B isn't required.

Relates to #764
2016-12-28 23:28:21 -05:00
Kevin K
eca609159a
test(Conditional Requirements): adds teste for conditional requirements 2016-12-28 23:21:40 -05:00