Commit graph

58 commits

Author SHA1 Message Date
Kevin K
6322806ea8 tests: updates tests to new verbiage 2016-03-16 19:26:20 -04:00
Kevin K
991aefc10a tests: updates tests to new verions 2016-03-16 10:22:00 -04:00
Kevin K
2c12757bbd feat(Help Subcommand): adds support passing additional subcommands to help subcommand
The `help` subcommand can now accept other subcommands as arguments to
display their help message. This is similar to how many other CLIs
already perform. For example:

```
$ myprog help mysubcmd
```

Would print the help message for `mysubcmd`. But even more, the `help`
subcommand accepts nested subcommands as well, i.e. a grandchild
subcommand such as

```
$ myprog help child grandchild
```

Would print the help message of `grandchild` where `grandchild` is a
subcommand of `child` and `child` is a subcommand of `myprog`.

Closes #416
2016-03-14 22:41:47 -04:00
Kevin K
e428bb6d84 tests: moves some \t tabs to four spaces for consistency 2016-03-13 22:07:28 -04:00
Kevin K
6efa298cba test: fixes failing doc tests 2016-02-19 01:47:37 -05:00
Kevin K
7596951a30 tests: adds additional tests for new setting and missing old tests 2016-02-02 07:21:01 -05:00
Kevin K
f17e150894 tests(Usage Parser): adds and fixes tests for usage parser 2016-01-28 11:45:31 -05:00
Kevin K
8c5ab033e7 tests: fixes broken python tests for optional values 2016-01-28 11:45:31 -05:00
Kevin K
0eba835968 tests: updated python tests to v2 info 2016-01-28 11:45:31 -05:00
Kevin K
0031d78564 refactor(v2): improving macros for code dedup 2016-01-28 11:45:31 -05:00
Sung Rim Huh
389d14ab85 tests(multiple_values): move tests related to multiple values 2015-12-10 09:09:50 -08:00
Kevin K
8988853fb8 imp(ArgMatcher): huge refactor and deduplication of code
Tons of code has been moved into functions, deduplicated, made much
easier to read, maintain, and understand. Comments still need to be
added, but that will happen shortly. Modules have also been moved around
to follow Rust conventions and best practices.

All functionality remains exactly the same
2015-11-11 10:26:05 -05:00
Kevin K
ddc650ea87 tests: adds diff to tests to find errors 2015-11-08 03:50:33 -05:00
Kevin K
a4c6272e38 tests(Exit Codes): adds some formatting and exit code testing 2015-11-03 01:03:02 -05:00
Kevin K
1e2fffe34c tests: updates tests to less quoty errors 2015-10-13 14:30:35 -04:00
Georg Brandl
e73b07e194 fix: grammar error in some conflicting option errors 2015-10-04 10:43:59 +02:00
Alexander Kuvaev
a4a00b03e3 tests: add tests for flag and groups conflicts 2015-09-06 13:46:58 +03:00
Kevin K
baab2e3f40 perf: changes BTreeSet for Vec in some instances 2015-09-04 13:04:24 -04:00
Kevin K
35b348655c tests(Possible Values): adds a test for --long=value possible values format 2015-08-26 19:50:54 -04:00
Alexander Kuvaev
eed54ff836 tests: moved code from claptests to lib.rs, also moved one test 2015-08-20 00:46:06 +03:00
Kevin K
fe96b39339 test: update run_tests.py to new help message 2015-08-01 00:49:08 -04:00
Kevin K
536d642e14 test: updates tests to new usage strings 2015-07-19 21:52:34 -04:00
Kevin K
3b202917d1 test: changes test help messages to new improvements 2015-07-16 01:27:58 -04:00
Kevin K
cc76ab8c2b imp(Errors): writes errors to stderr
Closes #154
2015-07-11 11:23:48 -04:00
Kevin K
dc7e1fcea5 imp(Usage): re-orders optional arguments and required to natural standard
Also renamed is '[POSITIONAL]' => '[ARGS]' to use the more standard
vernacular

Closes #147
2015-07-09 09:51:57 -04:00
Kevin K
a5b8b3584b test: fixes tests for 1.0 and deprecated functions 2015-06-29 22:21:47 -04:00
Kevin K
b2fab4652a tests: updates version switch to new default
Closes #138
2015-06-16 18:13:07 -04:00
Kevin K
d6c3ed54d2 imp(Colors): implements more structured colored output
Closes #129
2015-05-22 23:01:20 -04:00
Kevin K
c60e9183cc tests(Global Args): adds tests for global args 2015-05-22 13:18:02 -04:00
Kevin K
a5e25a563c tests(run_tests.py): update to new error messages 2015-05-06 12:36:12 -04:00
Kevin K
c445a100f9 tests(run_tests.py): uses new error messages 2015-05-06 12:36:03 -04:00
Kevin K
73d5a974eb tests(colors): removes ansi color codes before testing 2015-05-05 22:05:02 -04:00
Sebastian Thiel
0535cfb0c7 fix(did-you-mean): for review
* unknown subcommand message altered to use similar language as is used
  everywhere around clap. Namely, we say 'invalid' instead of 'unknown'
* 'did-you-mean' message separator changed from '. ' to '\n\t'

Related to #103
2015-05-05 17:12:20 -04:00
Sebastian Thiel
3631de580a refactor(makefile): hide comments
These comments show up on travis, which is not desired

[skip ci]
2015-05-05 17:12:20 -04:00
Sebastian Thiel
d3761a2c20 refactor(run_tests): python 2/3 compatibility
That way, it will run on travis as well, which comes with python 2
by default, and just doesn't have python 3 pre-installed.
It would probably take to much time to install, especially considering
it's super easy to have to script work in both worlds.
2015-05-05 17:12:20 -04:00
Sebastian Thiel
1cc2deb291 feat(did-you-mean): for possible values
There now is a single method which deals with formatting the
'did-you-mean' message, supporting different styles to cater all the
various needs that have arisen thus far, with enough potential to be
easily extended in future through a little helper-enumeration whose
variants can possibly take values.

*NOTE*: We might still want to have a look at where the did-you-mean
message should be located for best effect.

Related to #103
2015-05-05 17:12:20 -04:00
Sebastian Thiel
94dd9da1c5 tests(main.rs): add long --Option to -O
To facilitate running different branches of code that looks
rather similar.
2015-05-05 17:12:20 -04:00
Sebastian Thiel
0dd095f975 refactor(did-you-mean): dedup. thanks to suffix
That way, we use the prefix previously used by clap, but add our
particular 'did-you-mean' phrase as a suffix.
2015-05-05 17:12:20 -04:00
Sebastian Thiel
52a0b8505c feat(did-you-mean): for long flags (i.e. --long)
Long arguments now have a special case when saying they are unknown, as
we will match it against all known long flags and suggest the best match
to be used instead.

TODO: refactor to just write a suffix with did-you-mean information.

Related to #103
2015-05-05 17:12:20 -04:00
Sebastian Thiel
06e869b518 feat(did-you-mean): for subcommands
If an argument is not understood as subcommand, but has a
high-confidence match in the list of all known subcommands, we will use
this one to print a customized error message.

Previously, it would say that a positional argument wasn't understood,
now it will say that a subcommand was unknown, and if the user meant
`high-confidence-candidate`.

If the argument doesn't sufficiently match any subcommand, the default
handling will take over and try to treat it as positional argument.

* added dependency to `strsym` crate
* new `did_you_mean` function uses `strsim::jaro_winkler(...)` to look
  for good candidates.

Related to #103
2015-05-05 17:12:20 -04:00
Sebastian Thiel
d17dcb2920 imp(clap-test): simplified make test invocation
* assure `make test` works on OSX as well
* simplified entire makefile, by basically removing sed invocations to
  manipulate the Cargo.toml file under source control.
* *works for me* predicate

This should probably be tested on another system as well, just to be
sure it makes sense for everyone.
2015-05-05 17:12:20 -04:00
Kevin K
a87d970c93 tests(run_test.py): update help messages to new fixes 2015-05-04 22:01:28 -04:00
Kevin K
45e481cb1c tests(main.rs): adds new features to tests 2015-05-04 22:01:28 -04:00
Kevin K
7ab5037402 tests(run_tests.py): update error messages 2015-05-03 16:20:12 -04:00
Kevin K
713cab8a4f tests(run_tests.py): update known good error messages to new messages 2015-05-03 00:38:18 -04:00
Kevin K
cf7f6c80cd tests(usage): update known good tests to new usage strings 2015-04-30 19:32:51 -04:00
Kevin K
42d9b142b7 tests(run_tests.py): update tests to allow new shorthand multi values 2015-04-30 15:28:01 -04:00
Kevin K
dd693ab86d tests(usage): update to smart usage errors 2015-04-30 12:13:03 -04:00
Kevin K
0cc2f69839 feat(arg): allow other types besides Vec for multiple value settings
Breaking Change

Instead of requiring a Vec<&str> for various Arg::*_all() and
Arg::possible_values() methods this
commit now requires a generic IntoIterator<Item=AsRef<str>> which allows
things such as constant arrays. This change requires that any
Arg::*_all() methods be changed from vec!["val", "val"] -> let vals =
["val", "val"]; some_arg.possible_values(&vals) (or vals.iter()).

Closes #87
2015-04-29 17:52:13 -04:00
Kevin K
349927bfb1 tests(run_test.py): update tests to new error msgs 2015-04-27 00:54:21 -04:00