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
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
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
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
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"])
^~~~~~~~~~~~~~~
```
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
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