Commit graph

129 commits

Author SHA1 Message Date
Kevin K
908d78eb82
tests: adds tests against issue-725 part 2 2016-11-01 23:32:26 -04:00
Kevin K
74360184fa
tests(Multiple Values): renames some tests to reduce redundancy 2016-11-01 16:25:54 -04:00
Kevin K
ac49e7bc04
tests: adds tests for low index positionals with multiple(true) set 2016-11-01 16:25:54 -04:00
Kevin K
44f6b1edbf
tests: updates conflict tests to new more precise output 2016-10-31 00:35:13 -04:00
Wim Looman
f5b577c4fe tests: Add tests related to #706
Try and stress the combinations of DeriveDisplayOrder and UnifiedHelpMessage
along with propagating them to subcommands and explicitly setting a display
order.

The new tests

  derive_order_subcommand_propagate
  unified_help_and_derive_order_subcommand_propagate
  unified_help_and_derive_order_subcommand_propagate_with_explicit_display_order

are currently failing because of bug #706.
2016-10-26 20:47:19 +02:00
Kevin K
b94f897daf
tests(Help Message): adds tests to guard aginst multiple values throwing off alignment 2016-10-24 05:56:21 -04:00
Kevin K
e443f2d6c1
tests(AllowNegativeNumbers): adds some new tests for AllowNegativeNumbers and AllowLeadingHyphen 2016-10-21 09:42:25 -04:00
Kevin K
637d25dde3
tests: adds tests to guard against issue-688 2016-10-20 19:39:21 -04:00
Kevin K
440a21cfdc
tests: updates tests to new space counts in help messages 2016-10-20 19:39:21 -04:00
Kevin K
468baadb83
fix: fixes a bug that made determining when to auto-wrap long help messages inconsistent
Closes #688
2016-10-20 19:39:21 -04:00
tormol
996fc38176 docs: fix tests that fail when the "suggestions" feature is disabled 2016-10-16 11:31:12 +02:00
tormol
5778871951 style: remove the .ok() in result.ok().expect("...")
clippy doesn't check doc-tests and `include!()`d files,
so there might bee more un-reported lint.
2016-10-05 23:16:22 +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
Hideyuki Tanaka
8cd120c230 Fix the behavior of require_delimiter 2016-10-04 18:40:03 -04: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
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
Kevin K
d12649fd7b
tests: adds tests for value delimiters 2016-09-18 16:01:26 -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
4c8ae08e4c
tests(Help): adds tests for per argument hiding of possible values 2016-09-10 23:11:43 -04:00
Kevin K
9881a4a23a tests(Value Delimiters): updates tests to new value delimiter rules 2016-09-10 18:18:43 -04:00
Kevin K
2e99e22630 Merge branch 'master' into issue-617 2016-09-07 10:45:27 -04:00
Kevin K
934094d7c5 tests: updates tests for new help wrapping rules 2016-09-07 08:42:42 -04:00
Aluísio Augusto Silva Gonçalves
b9b55a39df
imp(YAML): supports setting Arg::require_delimiter from YAML 2016-09-06 13:30:31 -03:00
Kevin K
60de29a7ef tests: updates test to new help improvements 2016-09-05 20:46:18 -04:00
Kevin K
3617a1d493 test: updates app_settings tests for new bug fixes 2016-09-05 17:16:40 -04:00
Kevin K
b7793a2f4d Issues rollup (#637)
* feat: adds App::with_defaults to automatically use crate_authors! and crate_version! macros

One can now use

```rust
let a = App::with_defaults("My Program");

// same as
let a2 = App::new("My Program")
	.version(crate_version!())
	.author(crate_authors!());
```

Closes #600

* imp(YAML Errors): vastly improves error messages when using YAML

When errors are made while developing, the panic error messages have
been improved instead of relying on the default panic message which is
extremely unhelpful.

Closes #574

* imp(Completions): uses standard conventions for bash completion files, namely '{bin}.bash-completion'

Closes #567

* imp(Help): automatically moves help text to the next line and wraps when term width is determined to be too small, or help text is too long

Now `clap` will check if it should automatically place long help
messages on the next line after the flag/option. This is determined by
checking to see if the space taken by flag/option plus spaces and values
doesn't leave enough room for the entirety of the help message, with the
single exception of of if the flag/option/spaces/values is less than 25%
of the width.

Closes #597

* tests: updates help tests to new forced new line rules

* fix(Groups): fixes some usage strings that contain both args in groups and ones that conflict with each other

Args that conflict *and* are in a group will now only display in the
group and not in the usage string itself.

Closes #616

* chore: updates dep graph

Closes #633

* chore: clippy run

* style: changes debug header to match other Rust projects

* chore: increase version
2016-08-27 23:42:31 -04:00
Kevin K
cdb9037c15 tests: updates tests to account for variable term widths and non-english chars 2016-08-25 18:50:48 -04:00
Kevin K
881a647ee9 tests: adds tests to prevent issue 626 2016-08-24 21:50:20 -04:00
Kevin K
7558261c88 tests: adds tests for ignoring term width with set_term_width(0) 2016-08-24 19:39:31 -04:00
Kevin K
9e8e350b95 tests: adds tests for multi level help subcommands 2016-08-20 17:17:58 -04:00
Kathryn Long
aebc8fd828 tests(template): fix template asserts on windows 2016-07-26 23:46:06 -05:00
Barret Rennie
0ceba231c6 feat(Settings): Add unset_setting and unset_settings fns to App (#598)
Closes #590.
2016-07-24 00:08:24 -04:00
Kevin K
625cbbca0d test: adds tests for required_unless_one cases 2016-07-23 17:22:14 -04:00
Christopher Field
1b99091e0a tests: adds require_unless_one test cases
* test: `require_unless_one` with second argument

Add the `require_unless_one_2` test. This tests that when the second
argument in the array is used at the command line, that the required
argument is not present. This test was added because it appears the
`require_unless_one` function only works for the first argument in the
array.

* Fix: assertions for test

The assertions did not check for the `infile` to be present.
2016-07-23 13:43:22 -04:00
David Szotten
9f62cf7378 feat(Completions): adds the ability to generate completions to io::Write object 2016-07-14 09:38:13 +01:00
Bence Szigeti
f8ca3085da Fix: typo -- missing space and commas 2016-07-05 22:14:47 +02:00
Bence Szigeti
8d7bea823f Fix: extra space typo removed 2016-07-05 22:01:04 +02:00
Kevin K
93cbb56f77 tests: adds tests for leading hyphen issues 2016-07-01 13:50:32 -04:00
Kevin K
98a7e8a636 tests(Arg): adds tests for
Closes #546
2016-06-29 23:01:47 -04:00
Kevin K
c84834abbb tests(Options): adds tests to cover new stop parsing vals after spaces with equals or delims 2016-06-29 13:30:30 -04:00
Kevin K
4f805d53e7 tests(Usage Strings): updates usage string tests 2016-06-24 00:17:04 -04:00
Kevin K
ba68caa3d1 tests(Groups): adds test for groups with multiple allowed 2016-06-23 12:42:41 -04:00
Kevin K
eb7521a996 tests(Aliases): adds tests for alias help output 2016-06-12 21:52:18 -04:00
Kevin K
2ff981b9be tests: adds tests for visible aliases 2016-06-09 22:50:02 -04:00
Kevin K
5354d14b51 fix(Subcommands): subcommands with aliases now display help of the aliased subcommand
Imagine subcommand `foo` had alias `bar`, running `myprog help bar` now correctly displays the help
for `foo`

Closes #521
2016-06-09 20:39:53 -04:00
Kevin K
785ff83a14 tests(Settings): adds tests for DontDelimitTrailingValues 2016-06-07 23:49:05 -04:00