Commit graph

1411 commits

Author SHA1 Message Date
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
Kevin K
59152ed500 chore: updates clap-test to solve chicken and egg api issue 2016-05-09 21:09:41 -04:00
Kevin K
74c8a7f428 chore: moved clap-test to it's own repo 2016-05-09 21:06:31 -04:00
Kevin K
3ab0bf8826 chore: increase version 2016-05-09 20:50:32 -04:00
Homu
c8c20a046e Auto merge of #499 - kbknapp:issue-498, r=kbknapp
Issue 498

~~DO NOT MERGE~~
2016-05-10 08:58:30 +09:00
Kevin K
417dbc3057 test: adds test for new group deduping 2016-05-09 19:14:11 -04:00
Kevin K
3ca0947c16 fix(Usage Strings): now properly dedups args that are also in groups
For example, if an arg is part of a required group, it will only appear
in the group usage string, and not in both the group as well as the arg
by itself.

Imagine a group containing two args, `arg1` and `--arg2`

OLD:
    `myprog <arg1> <arg1|--arg2>`

NEW:
    `myprog <arg1|--arg2>`

Closes #498
2016-05-09 19:14:11 -04:00
Kevin K
f574fb8a7c fix(Usage Strings): removes duplicate groups from usage strings 2016-05-09 19:14:11 -04:00
Kevin K
deac597fc6 chore: updates dep graph 2016-05-09 19:14:11 -04:00
Kevin K
852e58156c tests: removes old python tests and replaces with rust tests
Closes #166
2016-05-09 19:14:11 -04:00
Kevin K
a0a56318d0 tests(Groups): adds tests for positional arg formatting in groups 2016-05-08 21:33:56 -04:00
Kevin K
fef11154fb imp(Groups): formats positional args in groups in a better way 2016-05-08 21:33:27 -04:00
Kevin K
250ed41f10 tests(Help): changes formatting for positional arguments 2016-05-08 20:38:13 -04:00
Kevin K
03dfe5ceff imp(Help): moves positionals to standard <> formatting 2016-05-08 20:37:51 -04:00
Homu
cff94579c1 Auto merge of #497 - kbknapp:rustfmt, r=kbknapp
style: rustfmt run
2016-05-07 08:01:09 +09:00
Kevin K
2efd81ebbc chore: clippy update and run 2016-05-06 17:59:52 -04:00
Kevin K
ffde90f2ba style: rustfmt run 2016-05-06 17:52:23 -04:00
Homu
b5841d207a Auto merge of #496 - kbknapp:issue-494, r=kbknapp
Issue 494
2016-05-06 11:58:04 +09:00
Kevin K
1628964a25 tests(Help): changes default help string to new version 2016-05-05 21:51:12 -04:00
Kevin K
5b7fe8e416 imp(Help): default help subcommand string has been shortened
Closes #494
2016-05-05 21:49:51 -04:00
Kevin K
dae2d93bdd Merge pull request #493 from kbknapp/v2.4.0
V2.4.0
2016-05-03 21:09:48 -04:00