Commit graph

22 commits

Author SHA1 Message Date
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
Kevin K
ac161fa3f4 tests(run_tests.py): update for new help format 2015-04-25 22:24:06 -04:00
Kevin K
b4758fec6f tests(main.rs): change version to new macros 2015-04-22 16:13:25 -04:00
Kevin K
09497c916b docs(clap): improve readability of examples with App::args_from_usage() 2015-04-13 18:08:25 -04:00
Kevin K
3710cd6916 fix(tests): fix failing doc tests 2015-04-13 15:03:22 -04:00
Kevin K
79e26a6b3e tests(clap-tests): add test support for new from_usage features 2015-04-13 14:59:34 -04:00
Kevin K
e2488e50e4 tests(subcommand help): change to new usage generation known good 2015-04-09 18:39:29 -04:00
Kevin K
08f130612a tests(clap-tests): add subcommand tests 2015-04-08 18:01:06 -04:00
Kevin K
52415f4ba3 chore(tests): rename claptests->clap-tests 2015-04-08 17:10:59 -04:00