Commit graph

187 commits

Author SHA1 Message Date
Kevin K
3d58197674 feat(from_usage): adds ability to add value names or num of vals in usage string
Allows new usage strings with value names or number of values. If the
names are consecutive, they are counted to represent the number of
values (if they all have the same name), or if their names are different
they are used as value names.

Closes #98
2015-05-05 17:12:20 -04:00
Kevin K
847001ff6d fix(help): fixes tab alignment with multiple values 2015-05-04 22:01:28 -04:00
Kevin K
c1c993c419 im(Options): adds number of values to options in help/usage 2015-05-04 22:01:28 -04:00
Kevin K
dd2a75640c fix(MultipleValues): properly distinguishes between multiple values and multiple occurrences
When using number_of_values() or value_names() you no longer have to set
.multiple(true) unless you want the argument to be allowed multiple
times (i.e. *not* the value, but the argument itself). This means
without multiple(true) set (and assuming 2 values) -o val1 val2 is only
allowed one time, but with multiple(true) set, -o val1 val2 -o val3 val4
is allowed.

Closes #99
2015-05-04 21:59:10 -04:00
Kevin K
a1fb94be53 fix(Options): fixes bug where options with no value don't error out 2015-05-03 20:31:56 -04:00
Kevin K
f66334d0ce fix(Options): fixes a bug where option arguments in succession get their values skipped 2015-05-03 17:02:10 -04:00
Kevin K
51087b693b style(app.rs): changes to follow Rust style guide 2015-05-03 16:24:44 -04:00
Kevin K
c236dc5ff4 im(ArgGroups): improves requirment and confliction support for groups 2015-05-03 16:15:54 -04:00
Kevin K
a29c3983c4 im(ErrorMessages): improves error messages and corrections 2015-05-03 15:49:18 -04:00
Kevin K
93c4a7231b fix(RequiredValues): fixes a bug where missing values are parsed as missing arguments 2015-05-03 15:39:49 -04:00
Kevin K
4de05f65fb perf(usage): improves usage string generation 2015-05-03 00:38:18 -04:00
Kevin K
12aea9612d fix(RequiredArgs): fixes bug where required-by-default arguments are not listed in usage
Closes #96
2015-05-03 00:38:06 -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
1f1fc04e1e docs(arg.rs): improves docs and fix typos 2015-05-01 10:19:19 -04:00
Kevin K
86d92c9fdb fix(MultipleValues): stops evaluating values if the max or exact number of values was reached 2015-04-30 22:17:10 -04:00
Kevin K
82d03638d3 docs(lib.rs): fix doc tests 2015-04-30 20:43:22 -04:00
Kevin K
0d123a0d86 docs(clap): update docs 2015-04-30 20:13:01 -04:00
Kevin K
53f6b8c9d8 feat(MultipleValues): add support for minimum and maximum number of values 2015-04-30 19:32:51 -04:00
Kevin K
ae09f05e92 feat(MultipleValues): adds support limited number and named values 2015-04-30 18:02:19 -04:00
Kevin K
6669f0a968 feat(MultipleValues): implement shorthand for options with multiple values 2015-04-30 15:11:12 -04:00
Kevin K
d77048efb1 feat(usage): implement smart usage strings on errors
Closes #88
2015-04-30 12:12:44 -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
1c92ed0e72 chore(docs): change makefile -> travis auto cargo doc and upload 2015-04-28 23:18:08 -04:00
Kevin K
ad4e545107 fix(from_usage): removes bug where usage strings have no help text
Creating arguments from usage strings with no help text previously
dropped the final character i.e. --flags -> --flag
This commit fixes that issue by testing if we are at the end of the
string

Closes #83
2015-04-28 22:11:20 -04:00
Kevin K
60c1b307ac docs(groups): adds documentation for ArgGroups 2015-04-27 22:52:50 -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
cfffb45aa4 style(clap): clean commented out code 2015-04-25 23:55:42 -04:00
Kevin K
17e3f141aa refactor(args.rs): deprecate mutually_excludes* for conflicts_with* methods 2015-04-25 22:59:02 -04:00
Kevin K
1e25abfc36 fix(help): change long help --long=long -> --long <long> 2015-04-25 22:19:09 -04:00
Kevin K
fd61615d1a perf(matchedargs): remove unused vars and String->&str
This commit increases the performance a bit by using string slices
instead of owned strings. The trade off is that code previously written
to handle all the argument parsing in a speratate function and return
only the ArgMatches must be re-written to add a lifetime specifier:

Old code 'fn handle_args<'a>() -> ArgMatches<'a>' needs another lifetime
specifier added, so now 'fn handle_args<'a, 'b>() -> ArgMatches<'a, 'b>'

BREAKING CHANGE
2015-04-25 11:12:07 -04:00
Kevin K
b76129e9b7 fix(from_usage): fix bug causing args to not be required 2015-04-22 16:08:34 -04:00
Kevin K
d7c724dc65 tests(usage): fix typo in test variable names 2015-04-22 11:23:15 -04:00
Kevin K
dc59b12eb0 refactor(app.rs): rename more_help()->after_help() 2015-04-20 19:55:09 -04:00
Kevin K
65cc259e45 feat(apps): add ability to display additional help info after auto-gen'ed help msg 2015-04-19 20:19:21 -04:00
Kevin K
bb9d0c377e tests(from_usage): add tests for usage strings with tabs 2015-04-19 14:31:56 -04:00
Kevin K
4fd44181d5 fix(from_usage): tabs and spaces should be treated equally 2015-04-19 14:27:05 -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
31b476ca99 refactor(arg.rs): remove deprecation warnings for stable rustc 2015-04-18 13:37:01 -04:00
Kevin K
14d810d072 refactor(clap): restructure matched args for performance and deduplication 2015-04-17 17:11:10 -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