Commit graph

1184 commits

Author SHA1 Message Date
Kevin K
dd8f21c7c1 imp(usage): usage strings now include parent command requirements
Closes #125
2015-05-17 18:20:32 -04:00
Kevin K
4a4229f500 feat(subcommands): subcommands can optionally negate parent requirements
Closes #123
2015-05-17 14:29:57 -04:00
Kevin K
ab4ec609cc imp(args): allows consumer of clap to decide if empty values are allowed or not
Closes #122
2015-05-17 14:21:38 -04:00
Kevin K
936332f7c3 chore(clap): increase version 2015-05-17 09:55:23 -04:00
Kevin K
23da4d619c chore(.travis.yml): builds against stable and nightly 2015-05-17 09:46:48 -04:00
Kevin K
bc12e78ead fix(args): - can now be parsed as a value for an argument
Closes #121
2015-05-17 09:45:16 -04:00
Kevin K
8dd2150aae chore(clap): increase version 2015-05-15 16:48:08 -04:00
Kevin K
30fa87ba4e feat(macros): arg_enum! and simple_enum! provide a Vec<&str> of variant names
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
2015-05-15 16:42:00 -04:00
Kevin K
d1219f0d13 feat(macros): arg_enum! and simple_enum! auto-implement Display
enums created with simple_enum! and arg_enum! now auto-implement
std::fmt::Display where the variant only is displayed.

Closes #120
2015-05-15 15:40:06 -04:00
Kevin K
0c264a8ca5 fix(macros): makes macro errors consistent with others
Mainly this is newline fixes

Closes #118
2015-05-15 15:40:06 -04:00
Kevin K
3c0636ef75 chore(clap): increase version 2015-05-12 18:16:57 -04:00
Kevin K
d2b3b1faa0 fix(suggestions): --help and --version now get suggestions
Closes #116
2015-05-12 18:12:14 -04:00
Kevin K
f3e2af811e chore(clap): increase version 2015-05-10 14:58:22 -04:00
Kevin K.
c87d3a7f37 Merge pull request #115 from kbknapp/dev
Closes #114
2015-05-10 14:48:00 -04:00
Kevin K
55d155827e fix(usage): groups unfold their members in usage strings
Closes #114
2015-05-10 14:43:34 -04:00
Kevin K
fd53cd1885 perf(usage): removes unneeded allocations 2015-05-10 14:27:00 -04:00
Kevin K.
6e75ce6d5a Merge pull request #113 from kbknapp/dev
chore(Rust): removes use of + with Vec<T>
2015-05-09 12:09:10 -04:00
Kevin K
da78da3620 chore(Rust): removes use of + with Vec<T> 2015-05-09 11:49:57 -04:00
Kevin K
58c8e2d44f chore(clap): increase version 2015-05-08 11:46:51 -04:00
Kevin K
eb0e374ecf fix(usage strings): positional arguments are presented in index order
Positional arguments are now presented in index order in suggested usage
strings which prevents out of order suggestions.

Closes #112
2015-05-08 11:37:45 -04:00
Kevin K
4903adde61 chore(clap): increase version 2015-05-06 12:47:32 -04:00
Kevin K.
73229bda2c Merge pull request #111 from kbknapp/less-color 2015-05-06 11:43:01 -04:00
Kevin K
a5e25a563c tests(run_tests.py): update to new error messages 2015-05-06 12:36:12 -04:00
Kevin K
fc79017ece fix(subcommands): stops parsing multiple values when subcommands are found
Closes #109
2015-05-06 12:36:03 -04:00
Kevin K
994474146e im(suggestions): adds suggested arguments to usage strings 2015-05-06 12:36:03 -04:00
Kevin K
55f71117c6 refactor(errors): fix error messages 2015-05-06 12:36:03 -04:00
Kevin K
c445a100f9 tests(run_tests.py): uses new error messages 2015-05-06 12:36:03 -04:00
Kevin K
aab44cca63 im(color): reduces color in error messages
Closes #110
2015-05-06 12:35:52 -04:00
Kevin K
05a34c8eec chore(clap): increase version 2015-05-05 22:11:37 -04:00
Kevin K.
0994caaccf Merge pull request #108 from kbknapp/patch-100
Closes #100 and other fixes
2015-05-05 22:10:14 -04:00
Kevin K
8745071c32 feat(Flags): adds sugestions functionality 2015-05-05 22:05:02 -04:00
Kevin K
0eda91a447 chore(.clog.toml): updates clog config 2015-05-05 22:05:02 -04:00
Kevin K
960389de02 docs(README): adds details about optional and new features 2015-05-05 22:05:02 -04:00
Kevin K
90e7b08187 fix(Positional): positionals were ignored if they matched a subcmd, even after '--' 2015-05-05 22:05:02 -04:00
Kevin K
a3e0671336 tests(arg_enum): adds tests 2015-05-05 22:05:02 -04:00
Kevin K
73d5a974eb tests(colors): removes ansi color codes before testing 2015-05-05 22:05:02 -04:00
Kevin K
632fb11514 fix(help): fixes bug where space between arg and help is too long 2015-05-05 22:05:02 -04:00
Kevin K
f8b26b13da feat(errors): colorizes output red on error 2015-05-05 22:05:02 -04:00
Tshepang Lekhonkhobe
8891d92917 docs(clap): fix typos caught by codespell
Thanks to [tshepang](https://github.com/tshepang) for catching these!
2015-05-05 22:02:14 -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
c0e383515d feat(did-you-mean): gate it behind 'suggestions'
You can now disable the did-you-mean feature entirely, which also
removes the additional dependency it comes with.
Learn more about features and how to use them here:
http://doc.crates.io/manifest.html#the-[features]-section

Related to #103
2015-05-05 17:12:20 -04:00
Sebastian Thiel
de7d10af4c tests(travis): added claptests based tests
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`.
2015-05-05 17:12:20 -04:00
Sebastian Thiel
9707917407 refactor(travis): update to latest version
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.
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
627ec103c9 refactor(app):dedup possible_values error-handling
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.
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
5407ac6cd6 refactor(app): better use of type-inference
Removing explicit typing makes the code more readable, which makes it
more maintainable, which probably helps everyone :).
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