Commit graph

1685 commits

Author SHA1 Message Date
Donough Liu
1b63516e3b Flow reordering 2021-01-30 17:24:11 +00:00
Donough Liu
47eee8ab2f Acc a request 2021-01-30 17:24:11 +00:00
Donough Liu
c6bcfe819e Clearer error processing 2021-01-30 17:24:11 +00:00
Donough Liu
8f4c26fc58 Minor redundant logic cleanup
Fix clippy

dot fix
2021-01-30 17:24:09 +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
90d786b8bc Dehack, revert #1856 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
AriusX7
448c102f4f fix: allow visible alias(es) in yaml files 2021-01-20 02:17:17 +05:30
Pavan Kumar Sunkara
42a4087220
Merge pull request #2299 from ldm0/terminator
Pick up missing setting
2021-01-18 22:13:20 +00:00
Donough Liu
09f43594b9 Fix doc test 2021-01-19 02:39:16 +08:00
Donough Liu
acdb94c1a5 Add assert to make doc test fails. 2021-01-19 02:37:07 +08:00
Donough Liu
6968f340c3 Fix clippy warnings 2021-01-19 02:24:58 +08:00
Donough Liu
c6da968ec7 Bump textwrap to 0.13.2 2021-01-02 13:15:50 +08:00
Martin Geisler
72884b2642 docs: Mention correct default value in term_width docstring
The default was correctly changed to 100 in #1950, but later
accidentally reverted in 89fcc75.
2020-12-31 08:55:56 +01:00
Pavan Kumar Sunkara
a0269a41d4
Merge pull request #2268 from ldm0/fixme
Better mkeymap
2020-12-28 10:09:27 +00:00
Donough Liu
0f115f18ad Fix positional count usage 2020-12-27 04:11:30 +08:00
Donough Liu
120e942e7a Private arg 2020-12-27 01:46:48 +08:00
Donough Liu
2b7fd731ae Private keys 2020-12-27 01:20:53 +08:00
Donough Liu
f54328ee4c Cleaner api and better inner documentation 2020-12-27 00:43:49 +08:00
Donough Liu
53fdc9d6b2 Fix clippy 2020-12-26 21:03:21 +08:00
Donough Liu
ad3d3a13cd KeyType: PartialEq for u64 2020-12-26 21:03:21 +08:00
Donough Liu
b2a066b24f Resolve a fixme, better code readability 2020-12-26 21:03:21 +08:00
budde25
c26d1a4421 imp: added more derives to common App, Arg, and ArgMatches 2020-12-23 17:26:53 -06:00
budde25
52635f00d4 docs(arg_matches.rs): clarified unclear behavior for is_present and value_of methods 2020-12-23 07:44:19 -06:00
Pavan Kumar Sunkara
4bd15c45d2
Merge pull request #2253 from ldm0/global
Propagate global arg in subcommand to subsubcommand
2020-12-14 02:20:34 +00:00
Pavan Kumar Sunkara
c4ab996339
Merge pull request #2252 from ldm0/lazy_propagation
Lazy propagation and _build cleaning
2020-12-12 16:56:09 +00:00
Donough Liu
1965b9f866 Add BinNameBuilt flag to App 2020-12-13 00:11:12 +08:00
Donough Liu
2f9846d048 Lazy subcommand propagation, avoid redundant _build() function call
rustfmt and clippy

Indepth cleaning

Apply suggestions
2020-12-12 22:32:20 +08:00
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
6fdad97a90 Remove unused flag 2020-12-10 00:58:11 +08:00
Donough Liu
e58f89b3ab Remove LowIndexMultiplePositional, stop repeatedly calc positional_count 2020-12-10 00:51:18 +08:00
Robin Moussu
6898fbde33 Automatically read license field from Cargo.toml 2020-12-09 00:16:19 +01:00
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