Commit graph

757 commits

Author SHA1 Message Date
Kevin K
2bc1908320 tests(ArgGroup): adds additional tests including YAML 2016-02-04 02:01:10 -05:00
Kevin K
fcbc7e12f5 fix: adds support for building ArgGroups from standalone YAML
ArgGroups can now be built from standalone YAML documents. This is
labeled as a fix because it should have been the case prior. A
standalone YAML document for a group would look something like

```
name: test
args:
    - arg1
    - arg2
required: true
conflicts:
    - arg3
requires:
    - arg4
```

This commit also keeps support building groups as part of a larger
entire App YAML document where the name is specified as a key to the
yaml tree
2016-02-04 02:01:10 -05:00
Alex Hill
85b11468b0 fix: Stop lonely hyphens from causing panic
The method `starts_with` as implemented for the `OsStrExt2` trait on
`OsStr` assumed that the needle given is shorter than the haystack. When
this is not the case, the method panics due to an attempted
out-of-bounds access on the byte representation of `self`. Problematic
if, say, an end-user gives us `"-"` and the library tries to see if that
starts with `"--"`.

Fortunately, slices already implement a `starts_with` method, and we can
delegate to it.

This *does* create a semantics change: if both `self` and the needle
have length 0, this implementation will return `true`, but the old
implementation would return `false`. Based on the test suite still
passing, acknowledging the vacuous truth doesn't seem to cause any
problems.

Fixes #410
2016-02-02 21:05:45 -08:00
Kevin K
c19a791745 imp(values): adds support for up to u64::max values per arg 2016-02-02 07:45:49 -05:00
Kevin K
d431417003 refactor(macros): does some code deduplication by macros 2016-02-02 07:45:49 -05:00
Kevin K
2704b300ec refactor(macros): implements a slightly better arg_post_processing 2016-02-02 07:45:49 -05:00
Kevin K
8f145f1024 refactor(macros): implements a better _handle_group_reqs 2016-02-02 07:45:49 -05:00
Kevin K
de32078d75 refactor(macros): implements a better vec_remove and remove_overriden 2016-02-02 07:45:49 -05:00
Kevin K
ca7f197a12 refactor: minor code cleanup 2016-02-02 07:45:49 -05:00
Kevin K
cdee7a0eb2 feat(AppSettings): adds HidePossibleValuesInHelp to skip writing those values 2016-02-02 07:21:01 -05:00
Kevin K
be2cbd9480 fix(App::args_from_usage): skips empty lines when parsing multiple lines from usage 2016-02-02 07:21:01 -05:00
Kevin K
ee96baffd3 fix(value_t_or_exit): fixes typo which causes value_t_or_exit to return a Result 2016-02-02 07:21:01 -05:00
Ceri Storey
3731ddb361 fix(matched_arg): Allow for more than 256 occurrences of an argument. 2016-02-02 19:30:32 +00:00
Kevin K
ab41be700b imp(arg_enum): enum declared with arg_enum returns [&'static str; #] instead of Vec 2016-01-31 08:23:34 -05:00
Kevin K
c19c17a885 fix(SubCommands): fixed where subcmds weren't recognized after mult args
Closes #405
2016-01-31 07:35:42 -05:00
Kevin K
0bcc712064 fix(Usage Parser): fixes a bug where literal single quotes weren't allowed in help strings
Closes #406
2016-01-31 07:12:07 -05:00
Vincent Prouillet
0c8b84af61 fix: clap_app! should be gated by unstable, not nightly feature 2016-01-30 11:16:13 +00:00
Kevin K
90542747ac chore: fixes doc and style mistakes 2016-01-28 21:58:40 -05:00
Kevin K
c28d24db3e fix: fixes nightly build with new lints 2016-01-28 11:46:12 -05:00
Kevin K
d182049119 chore: fixes failing rustdoc 2016-01-28 11:46:12 -05:00
Kevin K
a210f89b84 docs: updates examples for 2x release
Closes #394
2016-01-28 11:46:12 -05:00
Kevin K
518b89bd3d fix: fixes Windows build for 2x release
Closes #392
2016-01-28 11:46:12 -05:00
Kevin K
2031682193 chore: updates additional files for 2x release 2016-01-28 11:46:12 -05:00
Kevin K
d2a78e3e21 docs: updates documentation for v2 release 2016-01-28 11:45:31 -05:00
Kevin K
693aece2cb fix: fixes yaml build for 2x base 2016-01-28 11:45:31 -05:00
Kevin K
4c37b26a84 tests: fixes some failing doc tests 2016-01-28 11:45:31 -05:00
Kevin K
e494672ffc refactor: removes some unnecessary code checks 2016-01-28 11:45:31 -05:00
Kevin K
f1876388a7 docs: updating docs for 2x release 2016-01-28 11:45:31 -05:00
Kevin K
609c06e119 feat: adds support for external subcommands
External subcommands are now supported via the following:

```rust
extern crate clap;
use clap::{App, AppSettings};

fn main() {
    // Assume there is a third party subcommand named myprog-subcmd
    let m = App::new("myprog")
        .setting(AppSettings::AllowExternalSubcommands)
        .get_matches_from(vec![
            "myprog", "subcmd", "--option", "value", "-fff", "--flag"
        ]);
    // All trailing arguments will be stored under the subcommands sub-matches under a
    // value of their runtime name (in this case "subcmd")
    match m.subcommand() {
        (external, Some(ext_m)) => {
            let ext_args: Vec<&str> = ext_m.values_of(external).unwrap().collect();
            assert_eq!(ext_args ,["--option", "value", "-fff", "--flag"]);
        },
        _ => unreachable!()
   }
}
```

Closes #372
2016-01-28 11:45:31 -05:00
Kevin K
86f3e33975 refactor(macros): uses macros to implement Settings enums 2016-01-28 11:45:31 -05:00
Kevin K
26ecadd252 feat: adds support values with a leading hyphen
By using AppSettings::AllowLeadingHyphen values starting with a
leading hyphen (such as a negative number) are supported. This
setting should be used with caution as it silences certain
circumstances which would otherwise be an error (like forgetting
a value to an option argument).

Closes #385
2016-01-28 11:45:31 -05:00
Kevin K
35ad17a282 feat: adds support for turning off the value delimiter
Closes #352
2016-01-28 11:45:31 -05:00
Kevin K
0871145245 feat: adds support changing the value delimiter
Closes #353
2016-01-28 11:45:31 -05:00
Kevin K
c2e03a0a4e feat: adds support for comma separated values
This commit adds support for values separated by commas such as
--option=val1,val2,val3. It also includes support for uses
without the equals and shorts (both with and without)

--option=val1,val2
--option val1,val2
-oval1,val2
-o=val1,val2
-o val1,val2

Closes #348
2016-01-28 11:45:31 -05:00
Kevin K
4192e1acea test(Yaml): fixes yaml tests 2016-01-28 11:45:31 -05:00
Kevin K
eb4de9215f imp(From Usage): vastly improves the usage parser
Closes #350
2016-01-28 11:45:31 -05:00
Kevin K
95e8209712 feat: adds support with options with optional values
Closes #367
2016-01-28 11:45:31 -05:00
Kevin K
0eba835968 tests: updated python tests to v2 info 2016-01-28 11:45:31 -05:00
Kevin K
d707fa0fad tests(v2): updating yaml tests to new v2 base 2016-01-28 11:45:31 -05:00
Kevin K
0410873d8d chore: clippy run 2016-01-28 11:45:31 -05:00
Kevin K
bb52d2d194 chore: removes unneeded function 2016-01-28 11:45:31 -05:00
Kevin K
e874a0d5e0 feat(UTF-8): adds support for invalid utf8 in values
Closes #269
2016-01-28 11:45:31 -05:00
Kevin K
c3e96232c9 tests(v2): fixing more tests on the new v2 base 2016-01-28 11:45:31 -05:00
Kevin K
0031d78564 refactor(v2): improving macros for code dedup 2016-01-28 11:45:31 -05:00
Kevin K
7fc18e685f test(v2): fixing tests to pass under new v2 changes 2016-01-28 11:45:31 -05:00
Kevin K
20de5c6e76 feat(v2): implementing the base of 2.x
This commit implements the base changes for clap 2.x
2016-01-28 11:45:31 -05:00
Kevin K
d3a4834225 chore: fix failing nightly 2016-01-27 10:09:29 -05:00
messense
f0a0e4df50 docs(App) Fix App.print_help documentation 2016-01-10 16:44:24 +08:00
Kevin K
c9bf7e4440 fix: fixes an issue where invalid short args didn't cause an error
Closes #368
2016-01-03 22:54:13 -05:00
Kevin K
8f3817f665 fix: prints the name in version and help instead of binary name 2016-01-03 22:51:01 -05:00
Kevin K
ea83a3d421 fix: fixes an intentional panic issue discovered via clippy 2016-01-03 21:54:56 -05:00
Kevin K
55041bc878 chore: updates clippy 2015-12-19 05:35:44 -05:00
Kevin K
b9ff14bfff chore: changes build command features for Windows builds in testing 2015-12-18 09:01:59 -05:00
Kevin K
2b6511fe65 tests(fmt): removes fmt tests from Windows builds 2015-12-18 09:01:59 -05:00
Kevin K
faad83fbef fix: ArgRequiredElseHelp setting now takes precedence over missing required args
Closes #362
2015-12-17 23:51:57 -05:00
Sung Rim Huh
5ba8ba9dcc fix(errors): return correct error type in WrongNumValues error builder 2015-12-10 08:40:24 -08:00
Kevin K
99cdebc23d imp: clippy improvements 2015-12-08 05:17:30 -05:00
Kevin K
c4d2b17119 fix(Errors): fixes some instances when errors are missing a final newline 2015-11-20 08:23:39 -05:00
Kevin K
a35f76346f fix(Errors): fixes a compiling bug when built on Windows or without the color feature
Close #345
2015-11-14 04:51:44 -05:00
Kevin K
f03b88a976 fix(Required Args): fixes a bug where required args are not correctly accounted for
Closes #343
2015-11-13 09:34:26 -05:00
Kevin K
3359683380 refactor(Defaults): derives traits instead of manual implementation 2015-11-12 22:43:37 -05:00
Kevin K
8988853fb8 imp(ArgMatcher): huge refactor and deduplication of code
Tons of code has been moved into functions, deduplicated, made much
easier to read, maintain, and understand. Comments still need to be
added, but that will happen shortly. Modules have also been moved around
to follow Rust conventions and best practices.

All functionality remains exactly the same
2015-11-11 10:26:05 -05:00
Kevin K
5800cdec6d imp(Traits): refactoring some configuration into traits
There is now an AnyArg trait which lets you (clap dev, not consumer) get
info about certain args regardless of their type. Allows more generic
and de-duplicated code
2015-11-11 08:48:34 -05:00
Kevin K
1fdecfd519 style: moves mod names to follow rust standards 2015-11-09 07:17:23 -05:00
Kevin K
f5bfb41bf1 refactor: moves value validation out of App and into Option Args 2015-11-09 03:49:20 -05:00
Kevin K
1b69ca4bee refactor: moves code for ergonomics 2015-11-09 03:48:49 -05:00
Kevin K
bf4d8417b8 style: rustfmt run 2015-11-09 02:22:12 -05:00
Kevin K
c6858f7875 fix: fixes a bug with required positional args in usage strings 2015-11-09 02:01:21 -05:00
Kevin K
447786ed8a refactor(Usage): fixes some error handling duplication 2015-11-08 09:55:02 -05:00
Kevin K
bc4495b32e perf(App): more BTreeMap->Vec, Opts and SubCmds 2015-11-08 03:48:13 -05:00
Kevin K
d357640fab perf(App): changes flags BTreeMap->Vec 2015-11-08 01:50:12 -05:00
Kevin K
78971fd68d perf(App): removed unneeded BTreeMap 2015-11-08 01:08:06 -05:00
Kevin K
64b921d087 perf(App): changes BTreeMap to VecMap in some instances 2015-11-08 01:01:11 -05:00
Kevin K
111745c937 chore: updates clippy 2015-11-07 00:08:15 -05:00
Kevin K
cdc29175bc imp: massive errors overhaul 2015-11-03 08:26:17 -05:00
Kevin K
e59bc0c160 imp(Errors): errors have been vastly improved 2015-11-03 02:09:49 -05:00
Kevin K
ec0089d42e perf(App): removed excess clones 2015-11-03 02:07:57 -05:00
Kevin K
19538b9c22 chore: fixes features declarations 2015-11-03 01:59:08 -05:00
Kevin K
b261783c71 refactor(UsageParser): moves code for readability 2015-11-03 01:59:08 -05:00
Kevin K
89b51fdf8b fix(Error Status): fixes bug where --help and --version return non-zero exit code 2015-11-02 22:56:05 -05:00
Ben S
00b61ae226 Fix a bunch of typos in comments 2015-11-01 14:02:37 +00:00
Jimmy Cuadra
434f497ab6 docs: Clarify behavior of Arg::multiple with options. 2015-10-29 22:40:47 -07:00
Jimmy Cuadra
c1f66b5de7 docs: Fix typos and improve grammar. 2015-10-29 22:40:10 -07:00
Kevin K
1a8bf31e7a docs: adds comparison in readme
Closes #325
2015-10-29 01:07:43 -04:00
Kevin K
27df8b9d98 fix(Versionless SubCommands): fixes a bug where the -V flag was needlessly built
Closes #329
2015-10-29 00:23:09 -04:00
Kevin K
e639adad22 style: removes commented out code 2015-10-28 11:00:31 -04:00
Kevin K
d0c13d2960 style: rustfmt run 2015-10-28 10:56:10 -04:00
Kevin K
f161ffa470 chore: updates and implements lint findings 2015-10-28 10:55:26 -04:00
Kevin K
aff89d579b feat: allows parsing without a binary name for daemons and interactive CLIs
Closes #318
2015-10-28 06:45:49 -04:00
Kevin K
c47025dca2 fix(Safe Matches): using 'safe' forms of the get_matches family no longer exit the process
Closes #256
2015-10-28 05:55:04 -04:00
Kevin K
c9a9548a8f fix(Option Args): fixes bug with args and multiple values
Closes #323
2015-10-28 04:54:28 -04:00
Kevin K
e3be87cfc0 fix(Help and Version): only builds help and version once 2015-10-28 00:25:40 -04:00
Kevin K
34ce59ede5 fix(Errors): tones down quoting in some error messages
Closes #309
2015-10-13 13:46:35 -04:00
Kevin K
c78ce128eb fix: fixes crash on invalid arg error 2015-10-06 15:08:59 -04:00
Kevin K
6b90f1adad refactor(Errors): refactors how errors are created for deduplication
Closes #277
2015-10-05 21:47:39 -07:00
Kevin K
2a223dad82 fix(Unified Help): sorts both flags and options as a unified category 2015-10-05 20:36:30 -04:00
Georg Brandl
e73b07e194 fix: grammar error in some conflicting option errors 2015-10-04 10:43:59 +02:00
Kevin K
72b453dc17 fix(Usage): fixes a bug where required args aren't filtered properly
Closes #277
2015-10-03 09:22:15 -04:00
Kevin K
0e3733e4fe feat: supports -aValue style options 2015-10-02 16:46:37 -04:00
SungRim Huh
b7df92d7ea docs: clean up some formatting 2015-10-01 21:46:45 -04:00
SungRim Huh
d7233bf122 docs: move the crate-level docs to top of the lib.rs file 2015-10-01 16:48:25 -07:00
Kevin K
3183279acd Merge branch 'master' into rustdoc 2015-10-01 17:30:47 -04:00
Kevin K
34b601be5f docs: changes doc comments to rustdoc comments 2015-10-01 17:27:29 -04:00
Kevin K
0005154bcb Merge branch 'master' into issue-278 2015-10-01 14:28:09 -04:00
Kevin K
27018b1821 feat(Trailing VarArg): adds opt-in setting for final arg being vararg
Closes #278
2015-10-01 14:18:17 -04:00
Kevin K
05414a4b6d style: removes trailing whitespace 2015-10-01 14:16:02 -04:00
Kevin K
0f411c1c3e Merge branch 'master' into issue-298
skip-ci
2015-10-01 12:49:27 -04:00
Kevin K
aaf0d6fe7a fix(Usage Strings): fixes a bug ordering of elements in usage strings
Closes #298
2015-10-01 12:33:37 -04:00
Kevin K
6f9ee181e6 docs(Rustdoc): adds portions of the readme to main rustdoc page
Closes #293
2015-10-01 12:03:14 -04:00
Kevin K
958ebb8629 refactor: removes legacy panics and fixes grammar 2015-10-01 00:05:41 -04:00
Kevin K
a9aae2ade4 refactor: fixes a typo in the arg settings 2015-09-30 23:59:40 -04:00
Kevin K
f1031dac13 refactor: fixes a typo in the app settings 2015-09-30 23:59:40 -04:00
Kevin K
b01667ebb3 refactor: changes some arg fields to flags internally 2015-09-30 23:59:40 -04:00
Kevin K
7005cf8c47 style: removes trailing whitespace 2015-09-30 23:59:40 -04:00
Kevin K
b733bfbb6a refactor: adds the hidden setting to AppSettings 2015-09-30 23:59:40 -04:00
Kevin K
ffae52e64b refactor: refactor app settings into flags 2015-09-30 23:59:40 -04:00
Kevin K
6f2926e794 refactor(ArgBuilders): moves creation of builders to constructors 2015-09-30 23:59:40 -04:00
Kevin K
1412e639e0 fix(Help Message): required args no longer double list in usage
Closes #277
2015-09-30 12:54:00 -04:00
Kevin K
f121ae749f fix(Possible Values): possible value validation is restored
Closes #287
2015-09-30 10:23:26 -04:00
Kevin K
af8bfb1610 tests(ArgGroups): adds tests for ArgGroups
closes #279
2015-09-28 12:29:57 -04:00
Kevin K
c92a4b9eff feat: allows accessing arg values by group name 2015-09-28 12:22:09 -04:00
Kevin K
e17fcec53b fix(Conflicts): fixes bug with conflicts not removing required args
Closes #271
2015-09-22 15:38:04 -04:00
Kevin K
87ba54451d docs: properly names Examples section for rustdoc 2015-09-21 22:06:15 -04:00
Kevin K
c5bf7ddc8c feat(Unicode): allows non-panicing on invalid unicode characters 2015-09-21 21:58:25 -04:00
Alexander Kuvaev
a87c5cd660 fix(ArgGroup) added asserts to help users to configure clap properly
Also I've added tests for this change
2015-09-21 22:33:55 +03:00
Kevin K
931aea8842 docs(Arg): unhides fields of the Arg struct 2015-09-20 20:34:20 -04:00
Alex Gulyás
cbc42a37d2 fix: flush the buffer in App::print_version() 2015-09-18 23:58:05 +02:00
Dabo Ross
ffe1458882 Replace crate_version!() macro with simpler call
As of https://github.com/rust-lang/cargo/pull/1094, cargo publishes the full crate version as `CARGO_PKG_VERSION`, rather than *just* the parts of it.

This replaces the more complicated call with simply `env!("CARGO_PKG_VERSION").to_owned()`.
2015-09-12 20:22:01 -07:00
James McGlashan
13712da1d3 fix: Macro benchmarks 2015-09-10 22:23:58 +10:00
Kevin K
07f6d63e17 chore: increase version 2015-09-09 00:00:17 -04:00
Kevin K.
c0c1613188 Merge branch 'master' into issue-231 2015-09-08 22:49:07 -04:00
Kevin K
1e6403b6a8 feat(Errors): allows consumers to write to stderr and exit on error 2015-09-08 22:38:44 -04:00
Kevin K
56b95f3208 feat: allows printing help message by library consumers 2015-09-08 22:38:07 -04:00
Kevin K
f9c04aeb2c tests(App): adds print_help test 2015-09-08 21:03:20 -04:00
Kevin K
c92a98fb67 tests(Hidden Args): fixes tests to include hidden field 2015-09-08 21:02:54 -04:00
Kevin K
2cab4d0334 feat: allows defining hidden args and subcmds
Closes #231
2015-09-08 20:45:14 -04:00
James McGlashan
443841b012 feat: Builder macro to assist with App/Arg/Group/SubCommand building 2015-09-08 22:53:31 +10:00
Kevin K
94003db4b5 feat: adds abiltiy not consume self when parsing matches and/or exit on help 2015-09-07 21:18:00 -04:00
Kevin K
40229efd99 style: post rustfmt run 2015-09-06 21:37:45 -04:00
Alexander Kuvaev
b9ca261634 docs(ClapErrorType): changed examples content 2015-09-06 01:44:20 +03:00
Alexander Kuvaev
dd05784327 docs: fixed ClapErrorType docs 2015-09-06 01:12:46 +03:00
Alexander Kuvaev
934e6fbb64 feat(App): Added ability for users to handle errors themselves
Now you can use get_matches_safe instead of get_mathces if you want
to handle errors yourself.

This will allow now to write false-negative tests and check what type
of error occurs
2015-09-06 00:17:32 +03:00
Alexander Kuvaev
afaf198504 refactor(App): Now most parser function will return Result with Err...
... instead of hard exiting
2015-09-05 00:32:11 +03:00
Alexander Kuvaev
f5406076de Merge remote-tracking branch 'upstream/master' into report_error_refact 2015-09-04 22:58:25 +03:00
Kevin K
3cb4a48ebd perf: changes ArgGroup HashSets to Vec 2015-09-04 14:05:42 -04:00
Kevin K
e1694922f5 tests: adds test for ArgGroups 2015-09-04 13:58:00 -04:00
Kevin K
32044f26e0 tests: adds tests for PosBuilder Display 2015-09-04 13:29:57 -04:00
Kevin K
3a5bb17596 tests: adds tests for FlagBuilder Display 2015-09-04 13:29:45 -04:00
Kevin K
e27a3f3146 tests: adds tests for AppSettings FromStr 2015-09-04 13:16:24 -04:00
Kevin K
baab2e3f40 perf: changes BTreeSet for Vec in some instances 2015-09-04 13:04:24 -04:00
Kevin K
cfaae03b2a tests: adds tests for did_you_mean suggestions 2015-09-04 13:04:18 -04:00
Kevin K
63dbc5569f tests: adds tests for colored output 2015-09-04 11:59:33 -04:00
Alexander Kuvaev
f1c5bf5511 refactor(App): report_error refactoring 2015-09-04 00:51:37 +03:00
Kevin K
82a09abb32 Merge branch 'issue-205' of https://github.com/Vinatorul/clap-rs into vin-issue-205 2015-09-01 00:05:54 -04:00
Kevin K
b17808ffbd Merge branch 'master' into issue-80 2015-09-01 00:03:16 -04:00
Kevin K
ab41d7f382 docs(YAML): adds examples for using YAML to build a CLI 2015-08-31 23:57:35 -04:00
Kevin K
19b348a100 docs(Args from YAML): fixes doc examples 2015-08-31 23:57:35 -04:00
Kevin K
ecf88665cb feat(ArgGroups): adds support for building ArgGroups from yaml 2015-08-31 23:57:25 -04:00
Kevin K
e415cf78ba feat(Subcommands): adds support for subcommands from yaml 2015-08-31 23:57:16 -04:00
Kevin K
86cf4c4562 feat(YAML): allows building a CLI from YAML files 2015-08-31 23:57:16 -04:00
Kevin K
169ffec100 fix(Unified Help Messages): fixes a crash from this setting and no opts
Closes #210
2015-08-30 23:36:04 -04:00
Kevin K
f482387544 refactor: breaks up app code into different files 2015-08-30 17:10:26 -04:00
Kevin K
4f836ee5ef refactor(Examples): corrects compiler warnings about names
Closes #204
2015-08-30 15:43:57 -04:00
Alexander Kuvaev
5a8e341e8e refactor(ArgGroup): changed Vec<&str> using to &[&str] 2015-08-30 20:22:26 +03:00
Alexander Kuvaev
0cfecd328c tests: moved tests from lib.rs to tests.rs and tests dir 2015-08-28 21:48:37 +03:00
Kevin K
ad962ec478 feat(Args): allows opts and args to define a name for help and usage msgs 2015-08-27 12:05:23 -04:00
Kevin K
3d5e9a6ced fix(Possible Values): fixes a bug where suggestions arent made when using --long=value format
Closes #192
2015-08-26 19:49:39 -04:00
Kevin K
ff9628d24d chore: comments out clippy until 0.0.12 is on crates.io 2015-08-26 17:32:25 -04:00
Kevin K
5aa02042ca chore: separates nightly features from travis-cargo flags 2015-08-25 17:28:46 -04:00
Alexander Kuvaev
b41afa8c3d fix(App, Args): fixed subcommand reqs negation
Closes #188
2015-08-24 14:30:33 -04:00
Alexander Kuvaev
9c135eb790 fix(App): fixed requirmets overriding 2015-08-23 01:47:19 +03:00
Alexander Kuvaev
fc7a31a745 fix: fixed confusing error message, also added test for it 2015-08-22 12:45:25 +03:00
Alexander Kuvaev
999456969d tests: test for multiple flags in single 2015-08-22 00:04:36 +03:00
Alexander Kuvaev
56ea693084 tests: tests for flag using 2015-08-21 23:55:13 +03:00
Alexander Kuvaev
38fb26b9d7 tests: addet options values testing to some tests 2015-08-21 23:46:51 +03:00
Alexander Kuvaev
215fc821a7 tests: tests for options using 2015-08-21 23:42:47 +03:00
Alexander Kuvaev
133a26c2fb tests: rewrote test for multiple occurrences 2015-08-20 21:52:48 +03:00
Kevin K
754d6b7dd1 tests: adds tests for posix compatible conflicts 2015-08-19 21:44:25 -04:00
Kevin K
8c2d48acf5 feat: implements posix compatible conflicts for long args 2015-08-19 21:40:06 -04:00
Kevin K.
70e48d1357 Merge pull request #177 from Vinatorul/issue176
Added overrides to support conflicts in POSIX compatible manner
2015-08-19 21:23:24 -04:00
Alexander Kuvaev
eed54ff836 tests: moved code from claptests to lib.rs, also moved one test 2015-08-20 00:46:06 +03:00
Alexander Kuvaev
ddc3976a58 Merge branch 'issue176' of https://github.com/Vinatorul/clap-rs into issue176 2015-08-19 20:42:52 +03:00
Alexander Kuvaev
cd6649959f feat(Args) method to add multiple overrides at once 2015-08-19 20:37:17 +03:00
Kevin K
d715646e69 feat(Args): allows defining POSIX compatible argument conflicts 2015-08-18 23:59:04 -04:00
Kevin K
d0c3b37970 perf(Args and Apps): changes HashSet->Vec in some instances for increased performance 2015-08-18 22:04:22 -04:00
Alexander Kuvaev
5a18fa4ffe wip: removed 'o lifetime 2015-08-18 23:53:03 +03:00
Alexander Kuvaev
92b9f8f5bf wip: fixed docs and remove faulty #[cfg(test)] block 2015-08-18 23:27:24 +03:00
Alexander Kuvaev
0b916a00de feat: added overrides to support conflicts in POSIX compatible manner 2015-08-18 22:33:52 +03:00
Kevin K
19c46e1403 chore: fix until clippy on crates.io is updated 2015-08-14 20:58:18 -04:00
Kevin K
0349654717 docs: updates docs for new features 2015-08-14 20:25:21 -04:00
Kevin K
4a00e2510d imp(AppSettings): adds ability to add multiple settings at once 2015-08-14 20:17:14 -04:00
Kevin K.
3b020f9e42 Merge pull request #174 from kbknapp/issue-170
feat(Args): allows for custom argument value validations to be defined
2015-08-14 19:39:42 -04:00
Alexander Kuvaev
7df170d7f4 fix: fixed misspell and enum name 2015-08-15 02:11:20 +03:00
Kevin K
84ae2ddbce feat(Args): allows for custom argument value validations to be defined
Closes #170
2015-08-14 18:46:13 -04:00
Alexander Kuvaev
ade367780c docs: fixed docs for previous changes 2015-08-15 01:16:35 +03:00
Alexander Kuvaev
dc3ada7386 fix: fixed use for clap crate 2015-08-15 01:15:47 +03:00
Alexander Kuvaev
618dc4e2c2 feat: Replace application level settings with enum variants 2015-08-15 00:14:59 +03:00
Kevin K
8a2cd7f95f imp: code corrections thanks to rust-clippy 2015-08-14 00:21:16 -04:00
Kevin K
d63c013631 fix: fixes two bugs in App when printing newlines in help and subcommands required error 2015-08-01 00:44:20 -04:00
Kevin K
93e915dfe3 perf: removes some unneeded allocations 2015-07-29 17:55:02 -04:00
Kevin K
c9195c5f92 fix(Macros): fixes a typo in a macro generated error message 2015-07-19 22:03:59 -04:00
Kevin K
fe5d95c64f fix(Type Errors): fixes formatting of error output when failed type parsing 2015-07-19 21:52:34 -04:00
Kevin K
86c3be85fb imp(Usage Strings): displays a [--] when it may be helpful 2015-07-19 21:52:34 -04:00
Kevin K
9cb5dceb3e fix: fixes formatting bug which prevented compiling on windows
Closes #163
2015-07-18 14:31:09 -04:00
Kevin K
6d214b549a fix: fixes a bug when parsing multiple {n} newlines inside help strings 2015-07-16 22:16:50 -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
f9800a2969 imp(Help Strings): properly aligns and handles newlines in long help strings
Long help strings can now be broken up with newlines that will be
properly aligned in help messages. Simply place a `{n}` wherever you'd
like the newline to appear.

Closes #145
2015-07-16 01:27:58 -04:00
Kevin K
52bcd892ea feat: allows creating unified help messages, a la docopt or getopts
Allows creating help messages with a more unified look, similar to how
docopt and getopts are formatted. (i.e. flags and options are combined
into a single group)

Closes #158
2015-07-16 01:27:05 -04:00
Kevin K
336c476f63 feat: allows stating all subcommands should *not* have --version flags
Allows subcommands to disable the `--version` flag by using the
`App::versionless_subcommands(true)` method.

Closes #156
2015-07-16 01:26:11 -04:00
Kevin K
bc66d3c6de feat: allows setting version number to auto-propagate through subcommands
The version number can now be auto-propgated down through subcommands
with the App::global_version(true) method

Closes #157
2015-07-16 01:25:14 -04:00
Severen Redwood
8889689dc6 docs: fix incorrect code example for App::subcommand_required 2015-07-15 21:54:07 -04:00
Kevin K
cc76ab8c2b imp(Errors): writes errors to stderr
Closes #154
2015-07-11 11:23:48 -04:00
Kevin K
dc7e1fcea5 imp(Usage): re-orders optional arguments and required to natural standard
Also renamed is '[POSITIONAL]' => '[ARGS]' to use the more standard
vernacular

Closes #147
2015-07-09 09:51:57 -04:00
Kevin K
083f82d333 fix: allows empty values when using --long='' syntax
Closes #151
2015-07-08 14:57:28 -04:00
Kevin K
1528038fbb chore: silence macro definition warnings 2015-07-07 20:06:15 -04:00
Kevin K
753125282b feat: args can now be parsed from arbitrary locations, not just std::env::args() 2015-07-07 19:55:41 -04:00
Severen Redwood
3e8891c00b Fix typos in the documentation for the clap::App struct 2015-06-30 19:47:57 +12:00
Severen Redwood
2614a0fa8c Fix typos in the documentation for the .help() method 2015-06-30 19:21:30 +12: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
d0da3bdd9d feat: allows waiting for user input on error
In order to pause for user input on error use `.wait_on_error(true)` but
it's important to note that this is *not* recursive through subcommands.

This is useful on Windows when a user mistakenly opens an application by
double clicking it, instead of using the command line or if using a GUI
shortcut to run a program.

Closes #140
2015-06-29 21:59:26 -04:00
Kevin K
26d5ae3e33 feat(Help): allows one to fully override the auto-generated help message
Allows overriding the entire help message so that nothing is
auto-generated

Closes #141
2015-06-29 21:58:45 -04:00
Kevin K
ebf442ebeb docs: updates docs to new version flag defaults 2015-06-16 20:46:11 -04:00
Kevin K
eb1d9320c5 feat(Help and Version): allows overriding h/v short and changes default ver short to -V
The new default short for version is `-V` (capital). This is a "breaking"
change at least for documentation.

If the old lowercase `-v` is desired you can manually override with
`App::version_short("v")`

The help short can also be overridden now too.

BREAKING CHANGE
2015-06-16 16:54:20 -04:00
Kevin K
1f377960a4 fix(Global Args): global arguments propogate fully now
Closes #137
2015-06-06 17:08:39 -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
2191fe94bd imp(Binary Names): allows users to override the system determined bin name
Allows users to use `.bin_name("name")` to override the system
determined name with one of their choosing.

Closes #134
2015-05-30 13:09:21 -04:00
Kevin K
29ca7b2f74 feat: can now specify that an app or subcommand should display help on no args or subcommands
Closes #133
2015-05-25 21:49:27 -04:00
Kevin K
743eefe8dd docs: updates for deprecations and new features 2015-05-22 23:32:56 -04:00
Kevin K
d6c3ed54d2 imp(Colors): implements more structured colored output
Closes #129
2015-05-22 23:01:20 -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
52218cc1fd fix(help): allows parent requirements to be ignored with help and version
Parent requirements are now ignored when the user requests help or
version switches

Closes #124
2015-05-20 11:17:30 -04:00
Kevin K
08ba3f25cf fix(help): fixes a bug where requirements are included as program name in help and version 2015-05-17 20:22:40 -04:00
Kevin K
7554f238fd feat(subcommands): allows optionally specifying that no subcommand is an error
Closes #126
2015-05-17 18:21:55 -04:00
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
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
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
d2b3b1faa0 fix(suggestions): --help and --version now get suggestions
Closes #116
2015-05-12 18:12:14 -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
da78da3620 chore(Rust): removes use of + with Vec<T> 2015-05-09 11:49:57 -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
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
aab44cca63 im(color): reduces color in error messages
Closes #110
2015-05-06 12:35:52 -04:00
Kevin K
8745071c32 feat(Flags): adds sugestions functionality 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
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
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
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
Sebastian Thiel
52a0b8505c feat(did-you-mean): for long flags (i.e. --long)
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
2015-05-05 17:12:20 -04:00
Sebastian Thiel
06e869b518 feat(did-you-mean): for subcommands
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
2015-05-05 17:12:20 -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
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
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
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
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
91d2904599 fix(from_usage): trim all whitespace before parsing 2015-04-13 18:05:12 -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
5137278942 fix(usage): remove unneeded space 2015-04-09 21:43:26 -04:00
Kevin K
ba817b9d81 fix(usage): remove warning about unused variables 2015-04-09 19:53:13 -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
042577d254 refactor(app.rs): remove unneeded hashmap use statement 2015-04-05 20:25:03 -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
90e72cffde fix(flags): fix bug not allowing users to specify -v or -h 2015-04-04 16:13:51 -04:00
Kevin K
572bc31f08 style(app.rs): clean up misc items 2015-04-04 09:25:49 -04:00
Kevin K
ca17fa494b fix(help): fix spacing when option argument has not long version 2015-04-03 11:50:09 -04:00
Kevin K
9abdb438e3 fix(clap): remove unstable features for Rust 1.0 2015-04-03 11:02:46 -04:00
Kevin K
18dbcf3702 fix(args): improve error messages for arguments with mutual exclusions
Closes #51
2015-04-02 22:34:36 -04:00
Kevin K
c14c3f31fd fix(positional args): all previous positional args become required when
a latter one is required

Closes #50
2015-04-02 22:18:36 -04:00
Kevin K
e869100423 fix(help): fix formatting for option arguments with no long 2015-04-02 14:45:08 -04:00
Kevin K
a0a2a40fed fix(flags): add assertion to catch flags with specific value sets
Closes #52
2015-04-01 20:16:45 -04:00
Kevin K
82ad6ad775 fix(option args): fix bug in getting the wrong number of occurrences for options 2015-04-01 20:14:49 -04:00
Kevin K
6ceb88a594 fix(args): fix bug in arguments who are required and mutually exclusive
When arguments are required-by-default and also mutually exclusive with
other arguments and the user chooses the mutually eclusive argument, the
requirements must be updated as well.
2015-04-01 13:22:53 -04:00
Kevin K
28691b52f6 fix(help): fix formatting of help and usage 2015-04-01 13:22:53 -04:00