Commit graph

511 commits

Author SHA1 Message Date
Pavan Kumar Sunkara
1bd902370a Add tests for mut_arg on help and version 2021-02-07 15:54:24 +00:00
Pavan Kumar Sunkara
93a737a4fa
Merge pull request #2333 from clap-rs/build_help_and_version_at_start
Build help and version args at the beginning
2021-02-07 15:53:45 +00:00
Pavan Kumar Sunkara
c9cb22905c Build help and version args at the beginning 2021-02-07 14:46:38 +00:00
ldm0
560aa536df Change tests prefix 2021-02-07 05:59:29 +00:00
ldm0
fb3033834b Change the way parser do self override 2021-02-07 04:46:56 +00:00
Donough Liu
58b9f35771 Add tests, fix grouped_values_of()
Fix clippy

type complexity fix
2021-02-07 04:46:56 +00:00
ldm0
1000c9fb03 Fix eagerly trimming dash in parse_long_flag 2021-02-06 11:26:20 +00:00
Pavan Kumar Sunkara
8d5a021e1e
Merge pull request #2309 from ldm0/parser0
Dehack, Revert #1856
2021-01-30 14:52:02 +00:00
ldm0
5ee6e07858 Fix usage of positional grouped arguments uses arg name rather than val_name 2021-01-24 19:02:43 +00:00
Donough Liu
0df169bbdc Fix incorrect error message.
Comment out regressed logic

Fix clippy
2021-01-23 14:51:40 +00:00
Donough Liu
9477a5ffdb Correct tests, reveal real problem 2021-01-23 14:51:40 +00:00
Pavan Kumar Sunkara
d7f6748887
Merge pull request #2306 from ldm0/unset_setting
Fix unset_setting()
2021-01-23 13:37:57 +00:00
Bowen Ding
3907e11621
Make @group accept multiple attributes (#2248)
* Make @group accept multiple attributes.

* New syntax: remove parenthese and "=>".

* Fix example

* Make Clippy happy

* Make clippy happy again
2021-01-23 13:12:40 +00:00
ldm0
68a0ef930a Fix copied code 2021-01-23 06:41:11 +00:00
Pavan Kumar Sunkara
c156571f14
Merge pull request #2302 from AriusX7/visible-aliases
Allow visible alias(es) for args from YAML files
2021-01-20 18:07:06 +00:00
Donough Liu
d5e3c6b0b9 Add regression test for issue 2279 2021-01-21 01:09:20 +08:00
AriusX7
448c102f4f fix: allow visible alias(es) in yaml files 2021-01-20 02:17:17 +05:30
Donough Liu
fa9be84b18 Propagate global arg in subcommand to subsubcommand 2020-12-12 22:20:16 +08:00
Donough Liu
5f5474d803 Fix only one arg printed in multiple required_unless missing situation 2020-12-12 12:57:17 +08:00
Donough Liu
d7e2fd6294 Add regression test for issue 1794 2020-12-09 01:13:05 +08:00
Pavan Kumar Sunkara
b89163afb6 Update MSRV to 1.46 2020-11-28 11:58:28 +00:00
arthmis
a97e24630d chore: changing unrequired to non-required 2020-11-27 15:37:26 -05:00
arthmis
4e6a371851 chore: changing awkward grammar for positional argument error message 2020-11-27 15:12:28 -05:00
ldm0
347cd228a0 Add tests
Fix tests
2020-11-08 19:06:32 +00:00
Donough Liu
5e4b4f4196 Remove invalid suggestion on using subcommand after positional argument 2020-11-07 20:32:28 +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
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
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
Jacob Mischka
b3e638ad44
Add option to hide autogenerated env section from help text 2020-10-17 16:48:35 -05:00
David Hewitt
94f6889116 Don't use default value when option is passed 2020-10-14 20:00:40 +01: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
659d688543
test: add failing test for #2022
Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
2020-10-09 23:45:07 +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
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
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