Commit graph

1535 commits

Author SHA1 Message Date
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
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
bors[bot]
ed3bb993c5
Merge #2087
2087: refactor: Avoid second traversal and unwrap r=pksunkara a=phimuemue



Co-authored-by: philipp <descpl@yahoo.de>
2020-08-21 03:56:53 +00:00
aspen
96b7fd454b
Forbid all unsafe code. 2020-08-20 18:38:40 -04:00
philipp
86dc14f5cd refactor: Avoid second traversal and unwrap 2020-08-20 19:32:53 +02:00
Danil Kondratiev
4878f7b7b1
don't print spaces in long help 2020-08-20 17:25:36 +03:00
bors[bot]
1e3d53fd1f
Merge #2081
2081: Polish doc comments for App r=CreepySkeleton a=mkantor



Co-authored-by: Matt Kantor <the.matt.kantor@gmail.com>
2020-08-17 20:56:13 +00:00
bors[bot]
025ec3c28b
Merge #2078
2078: Unify naming cheme r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-17 20:35:05 +00:00
Matt Kantor
f6e28c5ff0 Remove doc mention of no-longer-existing from_yaml method. 2020-08-17 12:54:24 -07:00
Matt Kantor
494fddd06e Polish doc comments for App.
- Fix some links.
- Make the punctuation consistent.
- Correct some spelling/grammar mistakes.
2020-08-17 11:00:00 -07:00
tomjw64
27771ceeb7 Show arguments in conflict message in reverse order of input 2020-08-16 03:47:19 -05:00
tomjw64
97149e37f5 Remove underscore prefix for build_conflict_err_usage 2020-08-16 03:42:58 -05:00
tomjw64
35f761e699 Extract extra logic to _build_conflict_err_usage 2020-08-15 17:58:47 -05:00
CreepySkeleton
f4fb9db65c cargo fmt 2020-08-16 00:29:30 +03:00
CreepySkeleton
0b2eac4da7 Fix yaml support 2020-08-15 23:42:23 +03:00