Donough Liu
573dc245e6
Fix incorrect error message.
2020-12-09 01:12:58 +08:00
Jonas Platte
041bfda7ca
Fix a typo in the Clap trait docs ( #2243 )
...
* Fix a typo in the Clap trait docs
* Update src/derive.rs
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-12-08 01:40:18 +00:00
Pavan Kumar Sunkara
3c93f276b5
Merge pull request #2230 from ahkrr/master
...
refactor: TODO 1.46.0, improve readability by using [] operator
2020-11-28 13:11:50 +00:00
Pavan Kumar Sunkara
c8184470ff
Merge pull request #2140 from ldm0/validator_fixme
...
Resolve a FIXME
2020-11-28 13:11:38 +00:00
Pavan Kumar Sunkara
b89163afb6
Update MSRV to 1.46
2020-11-28 11:58:28 +00:00
hk
bb7c9896b0
refactor: TODO 1.46.0, improve readability by using [] operator
2020-11-28 11:38:34 +01:00
Donough Liu
cad893ed04
Resolve a FIXME
2020-11-28 18:31:42 +08:00
arthmis
a97e24630d
chore: changing unrequired to non-required
2020-11-27 15:37:26 -05:00
arthmis
1b4a4596f6
docs: fixing a typo
2020-11-27 15:19:03 -05:00
arthmis
4e6a371851
chore: changing awkward grammar for positional argument error message
2020-11-27 15:12:28 -05:00
Pavan Kumar Sunkara
d36d91173d
Merge pull request #2191 from ahkrr/master
...
fix(clap_generate): zsh completion generation panic
2020-11-26 18:36:41 +00:00
Pavan Kumar Sunkara
821d79aac7
Merge pull request #1878 from lu-zero/update_from_arg_matches
...
Add update_from_arg_matches to FromArgMatches
2020-11-14 12:38:16 +01:00
Luca Barbato
3e51839383
Rename the update trait methods
2020-11-14 10:58:30 +01:00
Luca Barbato
5d342a7438
Update to the new from_subcommand logic
2020-11-14 10:17:13 +01:00
Luca Barbato
a9276576d7
wip: Add a variant for augment* for updates
2020-11-14 10:17:13 +01:00
Luca Barbato
8b6255057d
wip: Complete update_subcommand
...
external subcommand updating is equivalent to replace it
2020-11-14 10:17:13 +01:00
Luca Barbato
646b3fe811
wip: Add tests and user-facing functions
2020-11-14 10:17:13 +01:00
Luca Barbato
d1fc83a8fa
wip: Add update_from_arg_matches to FromArgMatches
2020-11-14 10:17:13 +01:00
hk
895c903b61
refactor: adding get_global, making two functions private
...
preserving the observable behavior of the existing
public api, while handling global arguments separately in
get_arg_conflicts_with
2020-11-09 15:29:00 +01:00
ldm0
ff3b23824d
Fix wrong StrictUTF8 handling when AllowExternalSubcommands
2020-11-08 19:06:32 +00:00
Donough Liu
93b9bd9162
Apply suggestions
2020-11-08 23:06:24 +08:00
Donough Liu
407cdac8e0
Refactor: remove a persistent parser state ValidNegNumFound
2020-11-08 16:05:07 +08:00
Donough Liu
3c2f60c9f3
Remove unreachable branch in use_long_arg()
2020-11-08 16:05:07 +08:00
Donough Liu
7aa2358d6e
Simplify is_new_arg()
2020-11-08 16:05:07 +08:00
Donough Liu
b1c7785810
Remove replace variable
...
Resolve TODO
Small refactors
More descriptive replaced item recovering
2020-11-08 16:05:03 +08:00
Donough Liu
5e4b4f4196
Remove invalid suggestion on using subcommand after positional argument
2020-11-07 20:32:28 +08:00
Donough Liu
2b1f47f975
Reduce osstring construction
2020-11-07 16:43:14 +08:00
Donough Liu
020b07b77b
Typo fix
2020-11-07 16:43:14 +08:00
Donough Liu
582db739c8
Shrink
2020-11-07 16:43:14 +08:00
Donough Liu
f17b29acbb
Make Arg::env()
and Arg::env_os()
takes_value(false)
by default
2020-11-06 21:51:39 +01:00
hk
5650e37969
fix: compatability with rustc 1.42.0
...
fixup!
2020-11-05 13:08:04 +01:00
hk
1b451f62ad
fix(clap_generate): zsh completion generation panic
...
zsh completion generation would panic if a global argument
had conflicts with another argument which was present in its
own command but not in its subcommands
2020-10-30 21:04:17 +01:00
bors[bot]
97b4fb639f
Merge #2165
...
2165: Help & Version settings r=pksunkara a=pksunkara
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-10-28 06:27:49 +00:00
Pavan Kumar Sunkara
5dd9584119
Improve the logic for help & version building & parsing
2020-10-26 12:13:03 +01:00
Donough Liu
a19bfa1c35
Consistently wrap help and subcommand messages(with refactoring)
2020-10-25 22:43:01 +01:00
KBR9
625c201f65
Add docs about conflicts_with_all usage in yaml
...
add note about conflicts_with yaml option
add note about conflicts_with yaml option
fix wrapping
remove unnecessary sentence
remove note from conflicts_with
2020-10-24 21:54:01 +02:00
Pavan Kumar Sunkara
e8a06e79cd
Rename setting VersionlessSubcommands => DisableVersionForSubcommands
2020-10-24 16:04:49 +02:00
Pavan Kumar Sunkara
d6e2246aab
Rename setting DisableVersion => DisableVersionFlag
2020-10-24 16:03:12 +02:00
Pavan Kumar Sunkara
45f0ee8b55
Rename setting DisableHelpFlags => DisableHelpFlag
2020-10-24 16:03:12 +02:00
CastilloDel
88ac1f1803
Add assertions for required and default simultaneously
...
Add the suggested changes
Fix test issue_1050_num_vals_and_defaults
It used a required which isn't needed for the purpose of the test.
Add tests for the default+required assertions
Add test for positional args with long or short
2020-10-24 12:10:07 +01:00
bors[bot]
1d0b21908f
Merge #2178
...
2178: Various documentation fixes r=pksunkara a=cstyles
Co-authored-by: Collin Styles <collingstyles@gmail.com>
2020-10-18 22:08:05 +00:00
Collin Styles
0d4e2e5f9d
docs: remove links in documentation for requires_all
...
These links were broken but rather than fix them, let's just remove them
since they're inside the documentation for the function that they link
to which seems unnecessary.
2020-10-18 12:05:33 -07:00
Collin Styles
5b74d84f3c
docs: remove links in documentation for requires_if
functions
...
These links were broken but rather than fix them, let's just remove them
since they're inside the documentation for the functions that they link
to which seems unnecessary.
2020-10-18 12:05:32 -07:00
Collin Styles
3d5e1d987a
docs: add a bunch of missing links to the docs for Arg::env
2020-10-18 12:05:31 -07:00
Collin Styles
ba89a253fc
docs: remove link to allow_hyphen_values
...
This link was broken but rather than fix it, let's just remove it since
it's inside the documentation for the function that it links to which
seems unnecessary.
2020-10-18 12:05:30 -07:00
Collin Styles
8522b9c1cf
docs: fix another typo and add a missing link for Last
2020-10-18 12:05:29 -07:00
Collin Styles
eadecc5c1d
docs: add missing link in ArgGroup
documentation
2020-10-18 12:05:28 -07:00
Collin Styles
096338d163
docs: correct typo in ErrorKind
documentation
2020-10-18 12:05:27 -07:00
Collin Styles
75c1fdb707
docs: fix various copy-paste errors related to default_value
functions
2020-10-18 12:05:26 -07:00
Collin Styles
f7837b2ac0
docs: change single quotes to backticks
...
Pretty sure these are just typos.
2020-10-18 12:05:25 -07:00
Collin Styles
9f3cbcd149
docs: wrap Arg in backticks instead of quotes
...
This looks better and is more consistent with the rest of the
documentation.
2020-10-18 12:05:22 -07:00
Collin Styles
b3caf81918
docs: fix a bunch of broken documentation links
2020-10-18 12:05:19 -07:00
CastilloDel
acd3293af2
Add an assertion for positional args defining long or short
...
Also update the docs to reflect that Arg.index shouldn't be
used with long or short
2020-10-18 19:51:13 +01:00
Jacob Mischka
b3e638ad44
Add option to hide autogenerated env section from help text
2020-10-17 16:48:35 -05:00
bors[bot]
d2dd54b555
Merge #2172
...
2172: Don't use default value when option is passed r=pksunkara a=davidhewitt
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-10-14 20:54:10 +00:00
David Hewitt
94f6889116
Don't use default value when option is passed
2020-10-14 20:00:40 +01:00
Wim Looman
b31df047b8
Attach validation error as Error::source
2020-10-13 22:13:04 +02:00
bors[bot]
5a1a209965
Merge #2161
...
2161: Fix parser skipping options without heading set r=pksunkara a=CertainLach
Co-authored-by: Yaroslav Bolyukin <iam@lach.pw>
2020-10-11 08:55:33 +00:00
Donough Liu
7f627fceee
Change MissingArgumentOrSubcommand to DisplayHelpOnMissingArgumentOrSubcommand and don't use stderr
2020-10-11 15:42:47 +08:00
bors[bot]
4f90f3e4bb
Merge #2166
...
2166: Sort options base on option's short and long representation r=ldm0 a=ldm0
Co-authored-by: Donough Liu <ldm2993593805@163.com>
2020-10-10 18:54:49 +00:00
Donough Liu
15c77150a9
Sort options base on option's short and long representation
2020-10-11 02:08:10 +08:00
Marti Raudsepp
cda89a2af1
Fix typos and grammar
...
Some more fixes in addition to 594c535ba2
* Some I noticed manually.
* Some were found by Topy (https://github.com/intgr/topy ), either new
rules from Typo or new code in clap.
* `etc.` and `e.g.` rules were disabled during the last run.
2020-10-10 16:22:05 +03:00
Donough Liu
c9a407aa54
Fix: Don't mention unused subcommands (Partly cherry pick ef92e2b
)
...
Add `\t` for consistency
2020-10-10 03:34:28 +08:00
bors[bot]
4ff4879400
Merge #2154
...
2154: Fix the error logic and error message for suggesting `--` before a flag r=pksunkara a=ldm0
Co-authored-by: Donough Liu <ldm2993593805@163.com>
2020-10-09 19:05:13 +00:00
Yaroslav Bolyukin
6050a17024
fix : #2022
...
Parser was skipping default values for options with headings
Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
2020-10-09 23:45:11 +05:00
Donough Liu
9766aa11b1
Remove redundant(wrong) error processing
...
Argument prefixed by `-` will never inferred as a subcommand
Suggest using subcommand when supplied after `--`
Cargo fmt, adding test for wrongly using subcommand after `--`
Fix test
Fix clippy
2020-10-10 00:06:50 +08:00
Donough Liu
5815246fd9
Fix the error logic and error message for suggesting -- before a flag
...
Fix tests
Add test for issue #1284
Apply nitpicks
2020-10-10 00:04:22 +08:00
Pavan Kumar Sunkara
8131ead04b
More changelog and consistency
2020-10-09 17:05:51 +02:00
Pavan Kumar Sunkara
b931e25c79
Update MSRV to 1.42
2020-10-09 17:04:46 +02:00
bors[bot]
91633741e9
Merge #2143
...
2143: api(App): Adds help_about method to App. r=pksunkara a=pretzelhammer
Co-authored-by: pretzelhammer <7769424+pretzelhammer@users.noreply.github.com>
2020-09-26 06:55:58 +00:00
pretzelhammer
523729d3fc
api(App): Adds version_about method to App.
...
Version about text is now customizable and propagates to subcommands. Closes #1640 .
2020-09-25 09:06:35 -04:00
bors[bot]
87c9699931
Merge #2135
...
2135: fix(help messages): escape values in help messages r=pksunkara a=ninewise
Co-authored-by: Felix Van der Jeugt <felix.vanderjeugt@posteo.net>
2020-09-25 09:16:05 +00:00
Felix Van der Jeugt
d5c7c7d8bd
Fix clippy errors
2020-09-25 10:38:35 +02:00
pretzelhammer
33caf49793
api(App): Adds help_about method to App.
...
Help about text is now customizable and propagates to subcommands. Closes #2080 .
2020-09-24 17:53:02 -04:00
Felix Van der Jeugt
a083953d3a
Suggest corrections with double quotes
2020-09-24 17:58:35 +02:00
Pavan Kumar Sunkara
99b8830d0b
Remove unneeded cfg_attr
2020-09-24 13:51:02 +02:00
Pavan Kumar Sunkara
d881a1185b
Release 3.0.0-beta.2
...
clap@3.0.0-beta.2
clap_derive@3.0.0-beta.2
clap_generate@3.0.0-beta.2
Generated by cargo-workspaces
2020-09-18 20:32:41 +02:00
Felix Van der Jeugt
0f42344685
fix(help messages): escape whitespace values in help messages
2020-09-16 15:51:33 +02:00
bors[bot]
03c11607b5
Merge #2132
...
2132: Add missing links in docs. r=pksunkara a=newAM
Co-authored-by: Alex M <alexmgit@protonmail.com>
2020-09-12 18:28:23 +00:00
Alex M
96db338697
Add missing links in docs.
2020-09-12 10:15:14 -07:00
Alex M
3758725dc2
Fix for issue #2130 .
2020-09-12 09:52:52 -07:00
bors[bot]
3e9ee86713
Merge #2118
...
2118: Rename r=CreepySkeleton a=pksunkara
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-08-29 11:22:13 +00:00
bors[bot]
61786c4971
Merge #2117
...
2117: Remove useless code r=pksunkara a=CreepySkeleton
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-29 10:58:07 +00:00
Pavan Kumar Sunkara
55abd639f7
Rename get_*_no_heading to get_*_with_no_heading
2020-08-29 11:49:04 +02:00
Pavan Kumar Sunkara
9e381f92a9
Rename required_unless_eq_* to required_unless_present_*
2020-08-29 11:48:35 +02:00
CreepySkeleton
ccb1ea2d65
Remove useless code
...
This code does not serve any purpose as far as I can tell
2020-08-29 00:44:11 +03:00
CreepySkeleton
3a099a6627
Implement std::error::Error for clap::Error
2020-08-28 20:57:39 +03:00
bors[bot]
e4b5407296
Merge #1976 #2073
...
1976: Refactor r=pksunkara a=CreepySkeleton
2073: Add new "regex" feature r=CreepySkeleton a=bkaestner
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
Co-authored-by: Benjamin Kästner <benjamin.kaestner@gmail.com>
2020-08-28 17:14:31 +00:00
CreepySkeleton
5020333037
Refactor coloring
2020-08-28 19:21:05 +03:00
Benjamin Kästner
cde1a2d218
regex: Introduce convenience Cow-wrapper RegexRef
...
As previously discussed on [GitHub], this commit introduces a Cow-like
wrapper RegexRef to enable both `Regex` as well as `&Regex` as
arguments.
It also introduces a new module in the `build:arg` path to remove
clutter from the main module. For more information see #2073 .
[GitHub]: https://github.com/clap-rs/clap/pull/2073#issuecomment-674442310
2020-08-26 17:54:54 +02:00
Benjamin Kästner
8cb9a7d486
Add new "regex" feature
...
This commit introduces a new feature called `"regex"`. It adds a new
function `validator_regex` to `Arg` and was inspired by the discussion
in #1968 . The name `validator_regex` was chosen instead of
`regex_validator` to make sure that the developer keeps in mind that
there may only be a single `Validator` on an `Arg`.
The feature can be used with YAML files, however there is no proper
pattern in `clap_app!` (yet).
2020-08-26 17:54:54 +02:00
Sergey Dubovyk
d525be42c5
chore: use if instead of matching
...
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-25 11:07:19 +03:00
knidarkness
530b179776
fix: detect if space should be added before spec_vals
2020-08-25 10:41:08 +03:00
bors[bot]
29df5c2d16
Merge #2100 #2106
...
2100: Allow for nested subcommands with ZSH generation. r=pksunkara a=newAM
2106: Update the env var example for derive r=pksunkara a=rgreinho
Co-authored-by: Alex M <alexmgit@protonmail.com>
Co-authored-by: Rémy Greinhofer <remy.greinhofer@gmail.com>
2020-08-24 06:45:45 +00:00
bors[bot]
7853903052
Merge #2102
...
2102: Fix propagation r=pksunkara a=CreepySkeleton
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-24 06:22:27 +00:00
CreepySkeleton
1cd069090e
Fix propagation
2020-08-23 20:56:29 +03:00
Alex M
60dfcf13b5
Allow for nested subcommands with ZSH generation.
2020-08-23 09:33:29 -07:00
Simon Morgan
2e973a2649
Fix a few documentation typos
2020-08-22 16:49:09 +01:00
CreepySkeleton
28ad25fe66
Ensure the lifetime is 'static
2020-08-21 08:41:50 +03:00
CreepySkeleton
fd1ee7872e
Make caching in crate_authors! actually work
2020-08-21 08:21:21 +03:00