Commit graph

26 commits

Author SHA1 Message Date
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
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
b249f9657c im(arg_enum): allows ascii case insensitivity for enum variants
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
2015-05-05 17:12:20 -04:00
Kevin K
82b0c5c3d7 docs(macros.rs): fixes doc tests 2015-05-01 14:50:28 -04:00
Kevin K
22aef2ab45 style(clap): rustfmt run 2015-05-01 14:44:20 -04:00
Kevin K
08635e6b5e style(clap): makes changes to follow Rust style guide 2015-05-01 14:43:26 -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
4bb4c3cc07 fix(RequiredArgs): required by default args should no longer be required when their exclusions are present 2015-04-27 00:53:12 -04:00
Kevin K
09eb4d9893 feat(ArgGroups): add ability to create arg groups 2015-04-27 00:53:12 -04:00
Kevin K
c630969aa3 feat(macros.rs): add macro to get version from Cargo.toml 2015-04-19 14:22:03 -04:00
Kevin K
86e4075eb1 fix(macros.rs): fix use statements for trait impls 2015-04-18 22:23:18 -04:00
Kevin K
e7f77353b9 refactor(macros.rs): improve trait implmentation readability 2015-04-18 22:20:43 -04:00
Kevin K
2c499f8015 feat(macros): add ability to create enums pub or priv with derives
Err type of FromStr trait changed from &'a str->String in order
to allow showing valid values on failed parse

Breaking Change
2015-04-17 11:17:19 -04:00
Kevin K
fb672aff56 feat(macros): add macro to create custom enums to use as types 2015-04-16 14:21:32 -04:00
Kevin K
1a192521b6 docs(clap): fix typo core->std 2015-04-16 12:53:05 -04:00
Kevin K
d126cfdc69 chore(clap): rebuild docs with nightly rustdoc 2015-04-14 16:18:07 -04:00
Kevin K
4057d34d93 docs(macros): add documentation covering value_t! and value_t_or_exit 2015-04-14 15:16:16 -04:00
Kevin K
0b87251fc0 feat(macros): add ability to get mutliple typed values or exit 2015-04-14 14:33:37 -04:00
Kevin K
e243fe38dd feat(macros): add ability to get a typed multiple values 2015-04-14 14:07:33 -04:00
Kevin K
4b7cd3ea49 feat(macros): add convenience macro to get a typed value or exit 2015-04-14 13:37:35 -04:00
Kevin K
8752700fbb feat(macros): add convenience macro to get a typed value 2015-04-14 12:14:17 -04:00
Kevin K
b389743672 docs(clap): improve examples and documentation as well as include new from_usage() features 2015-04-13 22:18:50 -04:00
Kevin K
ab409a8f1d feat(args): add ability to create basic arguments from a usage string 2015-04-13 13:31:14 -04:00
Kevin K
dcbadc6275 perf(usage): remove compiler warnings and dedup some code 2015-04-10 11:50:08 -04:00