You can now use ArgName::variants() to get a Vec<&'static str> of
vairant names (Nice for Arg::possible_values()). It's not as good as
implementing Iterator for the enum, but that can't be done without being
able to concat AST tokens in order to make an "EnumIter" type which
implements iterator and keeps track of when to yield None. But the
overall intent of this issue was to be able to iterate variant names,
which is now possible.
Closes#119
* 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
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.
Run the python based --release mode tests as well. They are mainly
concerned with user facing messages, which are as important as the
internal tests run `cargo test`.
More about this can be found [here](http://goo.gl/vt07f7).
It's somewhat unnecessary, but I thought it might be good in preparation
for the next commit.
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
This is done in preparation for adding suggestions.
**NOTE**: We will now always use the ...
`"\"{}\" isn't a valid value for '{}'{}"`
... format, even though in one occasion, only a ...
`"\"{}\" isn't a valid value for {}{}"`
... format was used.
Hope that's alright and not breaking the world. At least, it doesn't
break any of the existing tests.
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
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
* 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.
Allows creating an enum with CamelCase to follow Rust guidelines, but
then will match ascii case insensitive. This means variant
SomeEnum::Emacs would match string "emacs".
Closes#104