Commit graph

528 commits

Author SHA1 Message Date
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