Commit graph

142 commits

Author SHA1 Message Date
Kevin K
327c514d7a
test(Options): adds a test against issue 665 2016-12-30 16:25:48 -05:00
Kevin K
3055e77ea7
tests(YAML): adds some of the new APIs to the YAML tests 2016-12-28 23:56:33 -05:00
Kevin K
60e1a3a02b
tests(Conditionally Required): adds tests for conditionally required args 2016-12-28 23:30:52 -05:00
Kevin K
eca609159a
test(Conditional Requirements): adds teste for conditional requirements 2016-12-28 23:21:40 -05:00
Kevin K
b03eff6df5
tests(Default Values If): adds tests for the new defualt_value_if[s] methods 2016-12-28 23:21:40 -05:00
Arnavion
f41ec962c2 feat(clap_app!): Support --("some-arg-name") syntax for defining long arg names
Used for arg names that aren't idents.

Ref #321
2016-12-12 22:42:11 -08:00
Arnavion
9895b671cf feat(clap_app!): Support ("some app name") syntax for defining app names
Used for setting names that aren't Rust idents.

Fixes #759
2016-12-12 22:42:11 -08:00
Arnavion
79bbf57815 tests(clap_app!): Added test for clap_app! macro. 2016-12-12 22:42:11 -08:00
Kevin K
56bd25ab38 Merge branch 'master' into issue-threedots 2016-12-01 23:54:22 -05:00
Daniel Luz
b1b16d56d8 imp(Completions): adds fallbacks to Bash completions
With these options, in case the completion function cannot provide
suggestions, Bash will perform its default completions, based on e.g.
files, directories, and variable names. This is particularly useful for
argument values.
2016-12-01 23:27:35 -02:00
Kevin K
29e362cc19
tests: adds tests against issue 760 help message alignment 2016-12-01 18:47:20 -05:00
Kevin K
d20331b6f7
fix(Required Unless): fixes a bug where having required_unless set doesn't work when conflicts are also set
Closes #753
2016-11-20 12:10:14 -05:00
Kevin K
cf9d6ce5cd
refactor: refactors the internals a bit
Flags, Opts, and Positionals now store their internals using compartmented Base, Valued, and
Switched structs to keep the code duplication down and make it easier to maintain.

Iniside the src/app/parser.rs there have been several changes to make reasoning about the code
easier. Primarily moving related sections out of the large get_matches_with into their own
functions.
2016-11-20 14:47:03 -05:00
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