Commit graph

7561 commits

Author SHA1 Message Date
Alex Helfet
b446a561ce tests(auto-completion): Update build_app_special_commands to include a sub-command with a hypen.
The tests pass but the bash completion script won't work yet.
2017-12-16 12:44:44 +00:00
Alex Helfet
09d1d4a568 tests(auto-completion): Normalise names in tests/completions.rs
From            -> To
===========================================
with_underscore -> (with_)?special_commands
WUS             -> SPECIAL_CMDS
special         -> special_help
SPECIAL         -> SPECIAL_HELP
2017-12-16 12:44:12 +00:00
Kevin K
e0f8479e0f
Merge pull request #1124 from Enet4/arg_enum_trailing_comma
Support trailing comma in arg_enum! fields
2017-12-07 16:45:28 -05:00
Eduardo Pinho
dde7fcf1ca Support trailing comma in arg_enum! fields 2017-12-07 00:53:55 +00:00
Kevin K
f38cb1dbb7
Merge pull request #1123 from rom1v/readme
Update default features in README
2017-12-05 09:44:57 -05:00
Xavier Bestel
cc6dfd2e54 Add doc on colored help (#40)
Added a note about `clap::App`'s _raw methods, and an example specifically about colored help text.
2017-12-05 15:20:17 +01:00
Romain Vimont
d954b3c734 Update default features in README
Since commit ac97edde90, feature
"wrap_help" is not enabled by default.

Update the README accordingly.
2017-12-05 13:55:57 +01:00
Kevin K
4442af96c6
Merge pull request #1122 from kbknapp/hide-env-vars
Hide env vars
2017-12-03 09:32:51 +09:00
Kevin K
e962f2cece
chore: increase version 2017-12-02 15:34:02 -05:00
Kevin K
ebc35bdc91
tests: adds tests for both showing and hiding the values inside ENV vars 2017-12-02 15:09:22 -05:00
Kevin K
fb41d062ee
api(Arg): adds Arg::hide_env_values(bool) which allows one to hide any current env values and display only the key in help messages 2017-12-02 15:09:21 -05:00
Kevin K
a652db08eb
Merge pull request #1121 from ignatenkobrain/patch-4
bump lazy_static to 1
2017-12-03 05:08:26 +09:00
Igor Gnatenko
f74e2dc45f
bump lazy_static to 1 2017-11-30 17:41:34 +01:00
Kevin K
bc9ab21934
Merge pull request #1119 from kbknapp/case-insensitive
Case insensitive
2017-11-29 00:35:31 +09:00
Kevin K
4e2881c3d2
docs: updates the contributors list 2017-11-28 08:57:04 -05:00
Kevin K
58a57d901b
chore: increase version 2017-11-28 08:57:04 -05:00
Kevin K
8c0cc5c386
style: rustfmt run 2017-11-28 08:57:04 -05:00
Kevin K
612ccaf14e
tests: adds tests for using possible_values with Arg::case_insensitive 2017-11-28 08:57:04 -05:00
Kevin K
80993357e1
api: Adds Arg::case_insensitive(bool) which allows matching Arg::possible_values without worrying about ASCII case
When used with `Arg::possible_values` it allows the argument value to pass validation even if
the case differs from that of the specified `possible_value`.

```rust
let m = App::new("pv")
    .arg(Arg::with_name("option")
        .long("--option")
        .takes_value(true)
        .possible_value("test123")
        .case_insensitive(true))
    .get_matches_from(vec![
        "pv", "--option", "TeSt123",
    ]);

assert!(m.value_of("option").unwrap().eq_ignore_ascii_case("test123"));
```

This setting also works when multiple values can be defined:

```rust
let m = App::new("pv")
    .arg(Arg::with_name("option")
        .short("-o")
        .long("--option")
        .takes_value(true)
        .possible_value("test123")
        .possible_value("test321")
        .multiple(true)
        .case_insensitive(true))
    .get_matches_from(vec![
        "pv", "--option", "TeSt123", "teST123", "tESt321"
    ]);

let matched_vals = m.values_of("option").unwrap().collect::<Vec<_>>();
assert_eq!(&*matched_vals, &["TeSt123", "teST123", "tESt321"]);
```

Closes #1118
2017-11-28 08:57:04 -05:00
Kevin K
e53c33d6b9
Merge pull request #1117 from kbknapp/clap_derive
Clap derive
2017-11-28 20:16:01 +09:00
Kevin K
ce6ca492c7
docs: changes the demo version to 2.28 to stay in sync 2017-11-28 04:38:37 -05:00
Kevin K
9ef3d82bd0
chore: increase version 2017-11-27 10:28:28 -05:00
Kevin K
6f4c341241
api: Adds the traits to be used with the clap-derive crate to be able to use Custom Derive
Currently to use these traits clap must be built with the `unstable` feature. This does not
require a nightly compiler. These traits and APIs may change without warning (hence the `unstable`
feature flag). Once they have been stablelized and the `clap-derive` crate is released the
`unstable` feature flag will no longer be required.
2017-11-27 09:55:52 -05:00
Kevin K
8a26ff07b0
style: changes the display of the env var from 'env:VAR: value' to 'env: VAR=value' 2017-11-27 09:55:43 -05:00
Kevin K
f94ef37893
Merge pull request #9 from kbknapp/arg_enum_case_sensitive
Add case sensitive option for ArgEnum
2017-11-26 08:09:11 -05:00
Guillaume Pinot
374f9080a8 v0.1.6 2017-11-25 23:45:02 +01:00
Guillaume Pinot
3186513b57 Improve doc about positional arguments
fix #33
2017-11-25 23:38:37 +01:00
Guillaume Pinot
5bf0d2ffb5 Don't call author, version and about if empty argument
fix #31
2017-11-25 23:36:05 +01:00
Kevin K
4740cde404
Merge pull request #1114 from ignatenkobrain/bash-comp
use .bash as extension for bash completions
2017-11-24 19:32:55 -05:00
Igor Gnatenko
bfcf5dd076 use .bash as extension for bash completions
* bash-completions have code to use only `foo`, `foo.bash` and `_foo`
files for completion
* /usr is proper place for system-wide stuff rather than /etc

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-11-23 18:48:36 +01:00
Guillaume Pinot
dca4b8daab Improve documentation.
Fix #30
2017-11-23 16:03:50 +01:00
Kevin K
c2c2a56a30
Merge pull request #1113 from kbknapp/issue-1112
Issue 1112
2017-11-22 07:19:33 -05:00
Kevin K
89c0ed0328
tests: adds tests to guard against --help and -h being overridable 2017-11-22 04:11:28 -05:00
Kevin K
a283d69fc0
fix: Fixes a regression where --help couldn't be overridden
Closes #1112
2017-11-22 04:11:28 -05:00
Kevin K
a224cdcc87
Merge pull request #1111 from ignatenkobrain/patch-3
bump version-sync to 0.5
2017-11-22 04:11:09 -05:00
Igor Gnatenko
6b98b6ab7d bump version-sync to 0.5 2017-11-22 09:53:33 +01:00
Kevin K
53864b5d72
Merge pull request #1063 from Eijebong/bitflags
Update bitflags to 1.0 and bump version
2017-11-22 02:36:29 -05:00
Bastien Orivel
dc00ec85eb Update the minimum version of rust 1.20.0 2017-11-21 12:39:12 +01:00
Bastien Orivel
a6593410c1 Update bitflags to 1.0 and bump version 2017-11-21 12:39:12 +01:00
Andrew Hobden
5ee70bbe99
Add case sensitive option for ArgEnum 2017-11-15 18:49:55 +01:00
Guillaume Pinot
1173955d37 v0.1.5 2017-11-14 15:19:33 +01:00
Guillaume Pinot
227d1fa73c fix bug with optional subsubcommand and Enum 2017-11-14 15:18:13 +01:00
Kevin K
c4d67d3263
Merge pull request #1109 from kbknapp/issue-1105
Issue 1105
2017-11-13 19:12:44 -05:00
Kevin K
0842fd1bcd
Merge pull request #1108 from focusaurus/issue-1106
docs: Fix URL path to github hosted files
2017-11-13 17:09:13 -05:00
Kevin K
17a4d8a860 tests: adds tests to guard aginst issue 1105 and empty values in options 2017-11-13 17:05:28 -05:00
Kevin K
2fb758219c fix: fixes a bug that allowed options to pass parsing when no value was provided
Since options have `empty_values(true)` by default, so long as another valid flag
or option came after the option in question, clap would parse it as an empty value
incorrectly. This commit forces the user to explicitly add an empty value.

`--option "" --flag` is allowed
`--option --flag` is no longer allowed unless the user has *also* set `min_values(0)`

This commit also fixes an issue where `-o=` would be parsed as a value of `Some("=")`
instead of `Some("")`.

Closes #1105
2017-11-13 17:02:52 -05:00
Kevin K
46c1317203 chore: silences unused macro warning for debug macros 2017-11-13 17:01:09 -05:00
Peter Lyons
ce72aada56 docs: Fix URL path to github hosted files
Closes #1106
2017-11-13 14:03:25 -07:00
Kevin K
39fae92997
Merge pull request #1107 from ignatenkobrain/patch-2
bump version-sync to 0.4
2017-11-13 14:47:40 -05:00
Igor Gnatenko
5cfafe4dcd
bump version-sync to 0.4 2017-11-13 18:57:47 +01:00