Commit graph

1281 commits

Author SHA1 Message Date
Kevin K
fc3e0f5afd feat(Settings): adds new setting to stop delimiting values with -- or TrailingVarArg
One can now use `AppSettings::DontDelimitTrailingValues` to stop clap's default behavior of
delimiting values, even when `--` or `TrailingVarArg` is used. This is useful when passing other
flags and commands through to another program.

Closes #511
2016-06-07 23:49:05 -04:00
Kevin K
7db45f78d8 chore: removes extra debug statements 2016-06-07 23:49:05 -04:00
Kevin K
706a7c11b0 fix(Settings): fixes bug where new color settings couldn't be converted from strs 2016-06-07 23:49:05 -04:00
Homu
a77c800da7 Auto merge of #520 - kbknapp:issues-512,518,519, r=kbknapp
Issues 512,518,519
2016-06-08 10:16:16 +09:00
Kevin K
01e7dfd6c0 fix(Windows): fixes a failing windows build 2016-06-07 20:49:18 -04:00
Kevin K
0d541a2534 Merge branch 'master' into issues-512,518,519 2016-06-04 21:13:49 -04:00
Kevin K
6e7f3e0556 tests(Usage Strings): adds tests for single positional arg usage strings 2016-06-04 11:55:47 -04:00
Kevin K
ec86f2dada imp(Usage Strings): improves the default usage string when only a single positional arg is present
Instead of blindly printing `[ARGS]` when only a single positional arg is present, it will now
print `[NAME]` (or `[NAME]...` for multiple values allowed)

Closes #518
2016-06-04 11:55:47 -04:00
Kevin K
17bc17c699 tests(Settings): adds tests for global subcommands 2016-06-04 11:55:47 -04:00
Kevin K
e23418351a feat(Settings): one can now set an AppSetting which is propogated down through child subcommands
Closes #519
2016-06-04 11:55:47 -04:00
Kevin K
cd44080650 fix: fixes bug where args are printed out of order with templates 2016-06-04 11:55:47 -04:00
Kevin K
04d27ce803 chore: increase version 2016-06-04 11:55:47 -04:00
Kevin K
8f630c6a07 fix: fixes bug where one can't override version or help flags
Closes #514
2016-06-04 11:55:47 -04:00
Kevin K
9582b82789 tests: adds test to check for before_help 2016-06-04 11:55:47 -04:00
Kevin K
330e5edf04 fix: fixes issue where before_help wasn't printed 2016-06-04 11:55:47 -04:00
Kevin K
c8cc87ac10 tests: updates help tests to remove extra newline 2016-06-04 11:55:47 -04:00
Kevin K
054f8cb433 imp: removes extra newline from help output 2016-06-04 11:55:47 -04:00
Kevin K
c5b24c0eb0 tests: removes extra newline from version output tests 2016-06-04 11:28:24 -04:00
Kevin K
a7401dc6a1 imp: allows printing version to any io::Write object 2016-06-04 11:28:24 -04:00
Kevin K
cda27469cd imp: removes extra newline when printing version 2016-06-04 11:28:24 -04:00
Kevin K
65c2350aa3 feat: colors dont get sent to pipes by default
Color are now only used when outputting to a termainal/TTY. There are three new settings as well
which can be used to control color output, they are:

 * `AppSettings::ColorAuto`: The default, and will only output color when outputting to a terminal or TTY
 * `AppSettings::ColorAlways`: Outputs color no matter where the output is going
 * `AppSettings::ColorNever`: Never colors output

This now allows one to use things like command line options, or environmental variables to turn
colored output on/off.

Closes #512
2016-06-04 11:28:03 -04:00
Homu
34e608c124 Auto merge of #517 - kbknapp:quick-issues, r=kbknapp
Quick issues

Relates to #515 #516 #514
2016-05-31 19:42:29 +09:00
Kevin K
05abb53486 fix: fixes bug where args are printed out of order with templates 2016-05-31 04:43:47 -04:00
Kevin K
638bf11cfe chore: increase version 2016-05-31 04:43:47 -04:00
Kevin K
90d7d6a2ea fix: fixes bug where one can't override version or help flags
Closes #514
2016-05-31 04:41:46 -04:00
Kevin K
24423e661e tests: adds test to check for before_help 2016-05-31 04:41:08 -04:00
Kevin K
b3faff6030 fix: fixes issue where before_help wasn't printed 2016-05-31 04:41:07 -04:00
Kevin K
84029aba18 tests: updates help tests to remove extra newline 2016-05-31 04:41:07 -04:00
Kevin K
86e61d19a7 imp: removes extra newline from help output 2016-05-31 04:41:07 -04:00
Kevin K
65b1de6d1f tests: removes extra newline from version output tests 2016-05-31 04:41:07 -04:00
Kevin K
921f5f7916 imp: allows printing version to any io::Write object 2016-05-30 04:48:47 -04:00
Kevin K
7e2e2cbb4a imp: removes extra newline when printing version 2016-05-30 04:48:13 -04:00
Homu
a86d6aac4b Auto merge of #508 - kbknapp:issue-505, r=kbknapp
docs: inter-links all types and pages

All doc pages should now be inter-linked between other doc pages and
Rust documentation.

Closes #505
2016-05-16 04:15:08 +09:00
Kevin K
3312893dda docs: inter-links all types and pages
All doc pages should now be inter-linked between other doc pages and
Rust documentation.

Closes #505
2016-05-15 14:23:37 -04:00
Homu
d392fd0edc Auto merge of #507 - kbknapp:issue-505, r=kbknapp
docs: makes all publicly available types viewable in docs

Some types weren't viewable in the docs, such as `Values`, `OsValues`,
and `ArgSettings`. All these types should now be browsable in the
docs page.

Relates to #505
2016-05-14 09:18:19 +09:00
Kevin K
52ca6505b4 docs: makes all publicly available types viewable in docs
Some types weren't viewable in the docs, such as `Values`, `OsValues`,
and `ArgSettings`. All these types should now be browsable in the
docs page.

Relates to #505
2016-05-13 18:52:29 -04:00
Kevin K
0c6c4ad743 Merge pull request #504 from kbknapp/v2.5.1
chore: increase version
2016-05-11 15:53:15 -04:00
Kevin K
d681a5b32c chore: increase version 2016-05-11 15:52:21 -04:00
Homu
11270d68d5 Auto merge of #503 - hoodie:master, r=kbknapp
test: adds failing alias doc test and example

Hey there,
I tried out the new aliasing feature, and they don't seem to play well with `.arg()`.
This produces a lifetime errors:

```bash
examples/20_aliases.rs:9:59: 9:74 error: borrowed value does not live long enough
examples/20_aliases.rs:9                                                 .aliases(&["list", "dir"])
                                                                                   ^~~~~~~~~~~~~~~
```
2016-05-12 04:31:34 +09:00
Hendrik Sollich
ac42f6cf0d Fix: SubCommand::aliases lifetime errors 2016-05-11 21:08:25 +02:00
Hendrik Sollich
6ba910e89b test: adds failing doc test 2016-05-11 20:16:56 +02:00
Kevin K
57c8777062 Merge pull request #502 from kbknapp/v2.5.0
V2.5.0
2016-05-10 19:26:44 -04:00
Kevin K
d4cafcc0fc chore: increase version 2016-05-10 17:15:06 -04:00
Kevin K
41a482cf5d imp(SubCommand Aliases): adds feature to yaml configs too 2016-05-10 17:15:06 -04:00
Homu
1de71c0058 Auto merge of #501 - kbknapp:issue-469, r=kbknapp
Issue 469
2016-05-11 05:48:14 +09:00
Kevin K
fd8e211895 tests(Subcommand Aliases): adds tests for new aliases 2016-05-10 15:26:43 -04:00
Kevin K
66b4dea65c feat(SubCommands): adds support for subcommand aliases
Allows adding a subcommand alias, which function as "hidden" subcommands that automatically
dispatch as if this subcommand was used. This is more efficient, and easier than creating
multiple hidden subcommands as one only needs to check for the existing of this command,
and not all vairants.

Example:

```
let m = App::new("myprog")
            .subcommand(SubCommand::with_name("test")
                .alias("do-stuff"))
            .get_matches_from(vec!["myprog", "do-stuff"]);
assert_eq!(m.subcommand_name(), Some("test"));
```

Example using multiple aliases:

```
let m = App::new("myprog")
            .subcommand(SubCommand::with_name("test")
                .aliases(&["do-stuff", "do-tests", "tests"]))
            .get_matches_from(vec!["myprog", "do-tests"]);
assert_eq!(m.subcommand_name(), Some("test"));
```

Closes #469
2016-05-10 15:21:19 -04:00
Homu
b027c659cd Auto merge of #500 - kbknapp:v2.4.1, r=kbknapp
chore: increase version
2016-05-10 16:18:32 +09:00
Kevin K
b42ca0b5ab chore(Tests): had to remove external clap-test crate...sad face 2016-05-09 22:46:09 -04:00
Kevin K
6c7b2da856 chore: increase ghost version 2016-05-09 21:10:30 -04:00