Commit graph

1544 commits

Author SHA1 Message Date
Kevin K
b37c010c1b imp(Default Values): displays the default value in the help text 2016-02-14 01:11:06 -05:00
Kevin K
1153e8af60 chore: clippy run 2016-02-14 01:10:44 -05:00
Kevin K
33fe291b34 chore: increase version 2016-02-10 12:55:54 -05:00
Kevin K
9facd74f84 docs(Default Values): adds better examples and notes for default values 2016-02-10 12:39:44 -05:00
Kevin K
9250b1323c tests: adds tests for default values 2016-02-10 10:56:58 -05:00
Kevin K
7321195296 feat(Defult Values): adds support for default values in args
Closes #418
2016-02-10 10:56:58 -05:00
Homu
e76d75197e Auto merge of #422 - kbknapp:issue-420, r=kbknapp
Issue 420

When value names are use, they will be displayed in help and error
messages instead of the argument name. For example, an argument named
`arg` but with the value name `FILE` will be displayed as `[FILE]`.
Likewise multiple value names will be displayed properly such as `[FILE1] [FILE2]`

Closes #420
2016-02-10 04:16:28 +09:00
Kevin K
972761912a chore: increase version 2016-02-09 09:30:41 -05:00
Kevin K
5460778f56 tests: adds tests for displaying positional args with value names 2016-02-09 09:29:23 -05:00
Kevin K
f0a99916c5 imp(Positional Arguments): now displays value name if appropriate
When value names are use, they will be displayed in help and error
messages instead of the argument name. For example, an argument named
`arg` but with the value name `FILE` will be displayed as `[FILE]`.
Likewise multiple value names will be displayed properly such as `[FILE1] [FILE2]`

Closes #420
2016-02-09 09:27:17 -05:00
Homu
dfca4ea238 Auto merge of #419 - GrappigPanda:master, r=kbknapp
Grammatical pedantry

I originally set out to only change liftimes to lifetimes, but I got a little carried away.

Fear not, I decided to stop myself partially through and actually start using your library!
2016-02-06 06:04:38 +09:00
Ian C
f0f425d5a4 Update README.md 2016-02-05 14:29:10 -06:00
Ian C
f0dbb8e939 Grammatical pedantry 2016-02-05 14:15:44 -06:00
Homu
f8ecb8e693 Auto merge of #417 - kbknapp:issue-415, r=kbknapp
Issue 415

Relates to #415
2016-02-05 16:54:43 +09:00
Kevin K
26f2e5feb0 tests(Multiple Values): fixes failing benches and adds tests to guard 2016-02-04 22:15:10 -05:00
Kevin K
ea4dd195f9 chore: increase version 2016-02-04 19:45:30 -05:00
Kevin K
2ba12b8b76 tests(Multiple Values): adds test for exact number of values 2016-02-04 19:44:30 -05:00
Kevin K
72c387da0b fix(Multiple Values): fixes bug where number_of_values wasnt respected
i.e. assume, option -O set to multiple, and number_of_values(1)
set. And assume a *required* positional argument is also set.

-O some -O other pos

Would fail with pos arg not supplied.

Relates to #415
2016-02-04 19:38:17 -05:00
Homu
106a13de06 Auto merge of #414 - kbknapp:globalvers, r=kbknapp
Globalvers
2016-02-04 23:29:51 +09:00
Kevin K
ff259626f7 chore: updates changelog 2016-02-04 11:56:47 -05:00
Kevin K
4f207a1195 tests(AppSettings): adds test for GlobalVersion 2016-02-04 11:55:58 -05:00
Kevin K
a62e452754 fix(AppSettings): fixes bug where subcmds didn't receive parent ver
Subcommands now receive the parent version when the setting
AppSettings::GlobalVersion has been set.
2016-02-04 11:54:46 -05:00
Homu
990ddfbc9a Auto merge of #413 - kbknapp:v2.0.4, r=kbknapp
V2.0.4

Common 90% coverage! 🙏
2016-02-04 22:15:00 +09:00
Homu
355a5fdabd Auto merge of #411 - cite-reader:hyphen-doesnt-panic, r=kbknapp
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-04 16:15:31 +09:00
Kevin K
9f7a4afea6 chore: increase version 2016-02-04 02:01:10 -05:00
Kevin K
a33e3df8f5 tests: adds tests for stdin char and only positional vals follow 2016-02-04 02:01:10 -05:00
Kevin K
8bcbce27f7 tests(Suggestions): adds additional tests 2016-02-04 02:01:10 -05:00
Kevin K
7166f4f110 refactor(macros): removes ok() from Result.ok().expect() 2016-02-04 02:01:10 -05:00
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
Homu
e47f825e97 Auto merge of #408 - kbknapp:minor-bug, r=sru
Bug fixes, new setting, code clean up, and added support u64::max values per arg

This turned into a little more than just a quick bug fix 😜

Thanks to #409 I've piggy backed on that and added support for > 256 values as well.

There's also just a bunch of code deduping and super small macro cleanups.

After this merges I'll put out 2.0.3
2016-02-03 11:04:14 +09:00
Kevin K
c31c2fbe07 Merge branch 'master' into minor-bug 2016-02-02 15:51:44 -05:00
Homu
700db3f9b1 Auto merge of #409 - cstorey:master, r=kbknapp
Allow for more than 256 occurrences of an argument.

Hi,

I often use tools with `xargs` and the like, and it's entirely possible to end up with inhumanly long sets of parameters being passed to a command.

Without this fix, the library will panic with an arithmetic overflow in `ArgMatcher#inc_occurrence_of` when the 256th instance of the parameter is accounted for.

Thanks,
2016-02-03 05:08:36 +09:00
Ceri Storey
f86a183e32 chore: Add myself to contributors. 2016-02-02 19:32:11 +00: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
dbea0e349b chore: increase version 2016-02-02 07:45:49 -05:00
Kevin K
07dfdd00ea tests(multiples): adds tests for > u8::max vals and occurrences 2016-02-02 07:45:49 -05: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
7596951a30 tests: adds additional tests for new setting and missing old tests 2016-02-02 07:21:01 -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
Homu
bc091c4a78 Auto merge of #407 - kbknapp:fixrollup, r=kbknapp
Fixrollup
2016-02-01 15:25:21 +09:00
Kevin K
2564b3af11 chore: increase version 2016-01-31 08:23:34 -05:00