Commit graph

50 commits

Author SHA1 Message Date
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
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