Commit graph

170 commits

Author SHA1 Message Date
Kevin K
8a2cd7f95f imp: code corrections thanks to rust-clippy 2015-08-14 00:21:16 -04:00
Kevin K
93e915dfe3 perf: removes some unneeded allocations 2015-07-29 17:55:02 -04:00
Kevin K
42b6d1fc3c fix: fixes a logic bug and allows setting Arg::number_of_values() < 2
Allows setting `Arg::number_of_values(qty)` where `qty` < 2. This allows
things such as `Arg::number_of_values(1)` in conjuction with
`Arg::multiple(true)` which would make invoking the program like this
`myprog --opt val --opt val` legal, but `myprog --opt val1 val2`
illegal.

Closes #161
2015-07-16 21:34:04 -04:00
Kevin K
a5b8b3584b test: fixes tests for 1.0 and deprecated functions 2015-06-29 22:21:47 -04:00
Kevin K
274484dfd0 imp: removes deprecated functions in prep for 1.0 2015-06-29 22:03:05 -04:00
Kevin K
a37842eec1 fix(Global Args): fixes a bug where globals only transfer to one subcommand
Closes #135
2015-05-31 00:45:07 -04:00
Kevin K
743eefe8dd docs: updates for deprecations and new features 2015-05-22 23:32:56 -04:00
Kevin K
2bcc6137a8 feat(Global Args): allows args that propagate down to child commands
Closes #131
2015-05-22 13:18:02 -04:00
Kevin K
28b7385552 depr(SubCommand/App): several methods and functions for stable release
SubCommand::new() -> SubCommand::with_name()
App::error_on_no_subcommand() -> App::subcommand_required()
2015-05-22 13:16:07 -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
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
Kevin K
05476fc61c docs(from_usage): explains new usage strings with multiple values 2015-05-05 17:12:20 -04:00
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
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
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
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
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
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
60c1b307ac docs(groups): adds documentation for ArgGroups 2015-04-27 22:52:50 -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
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
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
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
b67f2e537e docs(clap): fix failing doc tests 2015-04-13 22:26:41 -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
3710cd6916 fix(tests): fix failing doc tests 2015-04-13 15:03:22 -04:00
Kevin K
d5d48bcf46 feat(app): add support for building args from usage strings 2015-04-13 14:32:27 -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
3d960e8be0 docs(clap): clean up docs and add better explainations 2015-04-10 19:21:34 -04:00
Kevin K
dcbadc6275 perf(usage): remove compiler warnings and dedup some code 2015-04-10 11:50:08 -04:00
Kevin K
3636afc401 feat(usage): add ability to get usage string for subcommands too
You can now get the usage even for sub-commands by calling the
usage() method.

Breaking Change
ArgMatches::usage() now returns a slice (no longer an Option<&str>)
This is to improve ergonomics, as there should always be at least a
default usage statement, there should never be None
2015-04-10 10:49:12 -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
02462150ca feat(ArgMatches): add method to get default usage string 2015-04-09 18:18:51 -04:00
Kevin K
64e539280e feat(SubCommands): add method to get name and subcommand matches together 2015-04-09 17:07:28 -04:00
Kevin K
f4b2bf5767 feat(help): sort arguments by name so as to not display a random order 2015-04-05 20:20:46 -04:00
Kevin K
8078400941 feat(positionals): add support for multiple values
Add support for #44 (multiple values for positional arguments) when the
positional argument is the last one (i.e. highest index)
2015-04-01 13:02:58 -04:00
Kevin K
270eb88925 feat(args): add support for a specific set of allowed values on options
or positional arguments
2015-04-01 12:56:34 -04:00
Kevin K
9e8c1fb940 feat(arg): allow lifetimes other than 'static in arguments 2015-04-01 12:36:41 -04:00
Kevin K
6286d4b008 Closes #28 - Changed App name, version, about, author, and usage to allow lifetimes other than 'static 2015-03-23 22:34:01 -04:00
Kevin K
d5d1554b5e Cleaned up codebase...a little 2015-03-22 21:30:48 -04:00
Kevin K
cf4dc688a5 Fixed #22 2015-03-21 10:22:46 -04:00
J/A
1e1271ed8f Remove assertion on multi args.
There's an assertion on line 322 of clap-rs/master that prevents any arg
where `multiple == true` from accepting any value. This commit only
deletes that assertion. It could cause any number of other problems; I
don't really know.
2015-03-19 00:26:50 -04:00
Kevin K
19c205b72d Closes #17 2015-03-18 21:15:02 -04:00
Kevin K
01e3fc6ddd Closes #17 2015-03-18 20:35:42 -04:00
Kevin K
96d28df880 Initial commit for multiple option arguments 2015-03-18 18:09:42 -04:00
Kevin K
f270bc171f Restructured project to better reflect internal workings 2015-03-18 15:00:15 -04:00
Kevin K
9f4cdc9fa3 Changed tabs to spaces 2015-03-16 14:47:09 -04:00
Kevin K
65a8a4f045 Added support for subcommands 2015-03-15 17:17:52 -04:00
Kevin K
1a0b06147c Added documentation 2015-02-28 11:25:44 -05:00
Kevin K
0bf13bd5f2 Added documentation - and removed a pub-use 2015-02-28 10:43:49 -05:00
Kevin K
1cb1dcb73f Added documentation 2015-02-28 10:00:24 -05:00
Kevin K
da9607512b Added documentation 2015-02-28 09:40:53 -05:00
Kevin K
22d7bb0c42 Removed Clone from FlagArg 2015-02-28 09:30:34 -05:00
Kevin K
3f693870bb Adding documentation 2015-02-27 22:19:48 -05:00
Kevin K
e753b020e6 v0.0.5.6 2015-02-27 14:54:01 -05:00
Kevin K
3ab13ff0d1 v0.0.5.5 2015-02-27 14:27:34 -05:00
Kevin K
baabac4eea v0.0.4.9 2015-02-27 10:45:52 -05:00
Kevin K
1cbe2ae894 v0.0.4.8 2015-02-26 23:55:54 -05:00
Kevin K
5a2cbb46c1 v0.0.4.2 2015-02-26 20:21:30 -05:00
Kevin K
385d67da49 v0.0.3.5 2015-02-26 16:25:40 -05:00
Kevin K
2d546238a2 Initial commit v0.0.3 2015-02-25 08:37:25 -05:00