Commit graph

1655 commits

Author SHA1 Message Date
tormol
102fb7d2ce style: fix lints in yaml-related functions 2016-10-05 23:16:15 +02:00
tormol
215677bfa7 style: remove #[allow("warning that apparently doesn't exist")]
I say "apparently" because it's listed on https://manishearth.github.io/rust-clippy/master/
and not as deprecated.
2016-10-05 23:15:53 +02:00
Homu
3cb747d845 Auto merge of #680 - kbknapp:v2.14.0, r=kbknapp
chore: increase version
2016-10-05 12:16:15 +09:00
Kevin K
bbe457e993 chore: increase version 2016-10-04 21:20:35 -04:00
Homu
42d8aba1a1 Auto merge of #679 - kbknapp:pull-677, r=kbknapp
Fix the behavior of require_delimiter
2016-10-05 08:28:26 +09:00
Hideyuki Tanaka
8cd120c230 Fix the behavior of require_delimiter 2016-10-04 18:40:03 -04:00
Homu
50011f5b8b Auto merge of #678 - nabijaczleweli:master, r=kbknapp
tests(correctness): No longer use App::get_matches() in some places

Use `App::get_matches_from(vec![""])` instead not to fail when flags are passed to the test binary

Closes #676
2016-10-05 06:57:14 +09:00
nabijaczleweli
7b7aa87ddf
tests(correctness): No longer use App::get_matches() in some places
Use App::get_matches_from(vec![""]) instead not to fail when flags are
passed to the test binary

Closes #676
2016-10-04 23:22:43 +02:00
Homu
2472bb2f54 Auto merge of #675 - tormol:fix_werrnings, r=kbknapp
Some refactors / cleanups

I was fixing the clippy errors, but saw afiuna had already fixed them.
This is what's left after I rebased.
2016-10-05 03:07:51 +09:00
tormol
a214a34529 refactor(app::Parser) Replace continue and .push() with iterator adaptors 2016-10-04 19:15:18 +02:00
tormol
9679713a30 refactor(app::Help): Use map.values() and don't do if !foo when there is an else 2016-10-04 19:14:32 +02:00
tormol
7455d73404 refactor(app::Help): Replace str.split('\n') with str.lines() 2016-10-04 19:02:17 +02:00
Homu
4e7466ccce Auto merge of #674 - afiune:afiune/arg-aliases, r=kbknapp
feat(arg_aliases): Ability to alias arguments

There are some cases where you need to have an argument to have an
alias, an example could be when you deprecate one option in favor of
another one.

Now you are going to be able to alias arguments as follows:
```rust
Arg::with_name("opt")
    .long("opt")
    .short("o")
    .takes_value(true)
    .alias("invisible")
    .visible_alias("visible")
```

Closes #669

Also you can alias flags as follow:
```rust
Arg::with_name("flg")
    .long("flag")
    .short("f")
    .alias("not_visible_flag")
    .visible_alias("awesome_v_flag")
```
2016-10-05 01:51:09 +09:00
Salim Afiune
905d3b9777 Fix linting errors from rustc 1.14.0
The new version of rustc 1.14.0-nightly (144af3e97 2016-10-02) has new
linting warnings/errors. This commit fixes them.

Signed-off-by: Salim Afiune <afiune@chef.io>
2016-10-04 12:26:51 -04:00
Salim Afiune
40d6dac973 feat(flag_aliases): Ability to alias flags
Added same alias funtionality for flags, now you can do:
```
Arg::with_name("flg")
    .long("flag")
    .short("f")
    .alias("not_visible_flag")
    .visible_alias("awesome_v_flag")
```

Signed-off-by: Salim Afiune <afiune@chef.io>
2016-10-04 12:26:51 -04:00
Salim Afiune
e5d9760bea Added Arg::(visible_)alias(es) docs
Signed-off-by: Salim Afiune <afiune@chef.io>
2016-10-04 12:26:51 -04:00
Salim Afiune
33b5f6ef2c feat(arg_aliases): Ability to alias arguments
There are some cases where you need to have an argument to have an
alias, an example could be when you depricate one option in favor of
another one.

Now you are going to be able to alias arguments as follows:
```
Arg::with_name("opt")
    .long("opt")
    .short("o")
    .takes_value(true)
    .alias("invisible")
    .visible_alias("visible")
```

Closes #669
2016-10-04 12:26:51 -04:00
Homu
4c0ed77601 Auto merge of #670 - tormol:parse_nonascii_usage, r=kbknapp
Handle non-ascii names / options in from_usage().

Closes #664 and should make it faster too.

Why aren't the stop_at functions written like `c != a && c != b`?
2016-10-05 01:20:19 +09:00
tormol
fd4c0870be refactor(UsageParser tests) Use VecMap's .values() instead of .iter().map(|(_,&v)| v)
In many cases this makes the assert fit on one line, but the double references are a bit awkward.
2016-09-30 17:29:31 +02:00
tormol
42a6d232d4 refactor(UsageParser::parse) merge two ifs 2016-09-30 17:29:31 +02:00
tormol
bb1fa0d694 refactor(UsageParser) Make the functions passed to .stop_at() straightforward 2016-09-30 17:29:31 +02:00
tormol
1d6a7c6e7e fix(UsageParser): Handle non-ascii names / options.
This should also speeds up the parser (except maybe for short options).
Multi-codepoint characters still can't be used as short options, but people shouldn't non-ASCII options nyway.

Closes #664
2016-09-30 17:29:23 +02:00
Homu
5c7a2190cc Auto merge of #668 - nicompte:patch-2, r=kbknapp
docs: typo
2016-09-28 00:33:23 +09:00
Nicolas Barbotte
bac417fa1c docs: typo 2016-09-20 09:47:50 +02:00
Homu
7483cec06c Auto merge of #667 - kbknapp:issues-418,666, r=kbknapp
Issues 418,666
2016-09-19 05:23:23 +09:00
Kevin K
aad171d3e1
chore: increase version 2016-09-18 16:01:27 -04:00
Kevin K
6b9bd215c1
docs(Default Values): adds better examples on using default values
Closes #418
2016-09-18 16:01:27 -04:00
Kevin K
325610eb04
docs: updates README.md with new website information and updated video tutorials info 2016-09-18 16:01:27 -04:00
Kevin K
d12649fd7b
tests: adds tests for value delimiters 2016-09-18 16:01:26 -04:00
Kevin K
c81bc722eb
docs: updates the docs about removing implicit value_delimiter(true) 2016-09-18 15:24:44 -04:00
Kevin K
09d4d0a903
fix(Value Delimiters): fixes the confusion around implicitly setting value delimiters. (default is now false)
Now if one wishes to use value delimiters, they must explicitly set `Arg::use_delimiter(true)` or
`Arg::require_delimiter(true)`. No other methods implicitly set this value.

Closes #666
2016-09-18 15:22:55 -04:00
Homu
ecc6d89244 Auto merge of #662 - kbknapp:issue-661, r=kbknapp
Issue 661
2016-09-13 23:32:16 +09:00
Kevin K
44742844bc
chore: increase version 2016-09-12 23:28:12 -04:00
Kevin K
5c29448d54
tests(AllowLeadingHyphen): adds test issue 588 AllowLeadingHyphen not recognizing valid args 2016-09-12 23:26:49 -04:00
Kevin K
1ea9bef20d
test(Help Wrapping): adds tests for the old newline characters 2016-09-12 23:20:40 -04:00
Kevin K
92ac353b48
fix(Help Wrapping): fixes a regression-bug where the old {n} newline char stopped working
As of this commit, one can use the old newline character `{n}` or the new `\n`

Closes #661
2016-09-12 23:19:26 -04:00
Homu
804a60f781 Auto merge of #660 - kbknapp:issue-588, r=kbknapp
Issue 588
2016-09-13 11:25:56 +09:00
Kevin K
fd4414768d
chore: increase version 2016-09-12 21:59:46 -04:00
Kevin K
a9699e4d7c
fix(AllowLeadingHyphen): fixes a bug where valid args aren't recognized with this setting
Closes #588
2016-09-12 21:48:50 -04:00
Kevin K
0dcfc77dae
tests(Debugging): standardizes certain debugging calls 2016-09-12 21:48:22 -04:00
Homu
703b001d06 Auto merge of #658 - kbknapp:issue-640, r=kbknapp
Issue 640
2016-09-12 03:09:32 +09:00
Kevin K
8ffd7b827c Merge branch 'master' into issue-640 2016-09-11 13:00:04 -04:00
Homu
317402d9e1 Auto merge of #659 - nabijaczleweli:docs/appsettings/disableversion-doc, r=kbknapp
Document AppSetting::DisableVersion

Closes #589
2016-09-12 00:28:07 +09:00
nabijaczleweli
945019654d
docs(appsettings): Document AppSetting::DisableVersion
Closes #589
2016-09-11 10:31:35 +02:00
Kevin K
4c8ae08e4c
tests(Help): adds tests for per argument hiding of possible values 2016-09-10 23:11:43 -04:00
Kevin K
9151ef7398 feat(Help): adds ability to hide the possible values on a per argument basis
Previously one could only hide the possible values of an argument application or command wide, and
not on a per argument basis. Now one can use the `Arg::hide_possible_values(bool)` method to hide
only that arguments possible values.

Closes #640
2016-09-10 23:07:15 -04:00
Homu
82234fa93f Auto merge of #657 - kbknapp:issue-655, r=kbknapp
Issue 655
2016-09-11 11:19:41 +09:00
Kevin K
f9d17a060a docs(Value Delimiters): updates the docs for the Arg::multiple method WRT value delimiters and default settings 2016-09-10 18:23:31 -04:00
Kevin K
f9e692548e imp(Value Delimiters): changes the default value delimiter rules
Prior to this change, values were always delimited by default. This was causing issues with code
where the arg had a single value, and contained valid commas and shouldn't be delimited. This
commit changes the rules slightly so that values are not delimited by default, *unless* one of the
methods which implies multiple values was used (max_values, value_names, etc.).

This means single value args should *not* be delimited by default. If one wishes to use the old
way, they can add `Arg::use_delimiter(true)` to such code.

Closes #655
2016-09-10 18:19:33 -04:00
Kevin K
9881a4a23a tests(Value Delimiters): updates tests to new value delimiter rules 2016-09-10 18:18:43 -04:00