NickHackman
1127ca6e13
feat: Usage displays short, long, and normal scs
...
Displayed in the form of
pacman {query, --query, -Q} [OPTIONS]
2020-07-08 21:37:56 -04:00
NickHackman
ec35ab8813
feat: long flag subcommand infer
...
Added tests and feature to infer long flag subcommands similarly to
normal subcommands.
2020-07-08 00:11:28 -04:00
NickHackman
1ea7178629
refractor: find_*_subcmd macro -> fn
...
Moved from macro implementations to function implementations.
2020-07-07 22:57:38 -04:00
NickHackman
59a14f8e6a
fix: no longer cloning all Apps and Args for debug
...
Previously `Flag::App` and `Flag::Arg` both owned their App/Arg which
required many, many clones. This is unnecessary.
2020-07-07 22:36:12 -04:00
NickHackman
5db25e6a72
refractor: improved parser ergonomics
...
No longer abusing external_subcommand, but using subcmd_name in order to
parse a subcommand, added a `keep_state` variable in order to handle the
hacky solution of short command line arguments.
2020-07-07 22:26:44 -04:00
NickHackman
8a68f99750
example: more pacman-like and refractor
...
Removed user facing panics and improved ergonomics to behave more like
pacman behaves.
2020-07-07 21:26:38 -04:00
Kitlith
96daa203b9
cargo fmt
2020-07-07 00:23:00 -07:00
Kitlith
5f601b7ecd
Manually specify the header for subcommands.
...
Also fleshed out the documentation for subcommand_placeholder a bit.
2020-07-06 20:08:26 -07:00
bors[bot]
e8d46f4036
Merge #1989
...
1989: Replace macros with proper functions r=pksunkara a=CreepySkeleton
Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-07-06 18:51:07 +00:00
CreepySkeleton
7e8d120543
Make getters return iterators rather than slices
2020-07-06 17:33:02 +03:00
CreepySkeleton
51d0b31105
Fix test
2020-07-06 17:26:53 +03:00
CreepySkeleton
46679d88d6
Use method(bool) instead of manipulating ArgSettings explicitly
2020-07-02 05:42:28 +03:00
CreepySkeleton
b23890358a
Remove ArgSettings::UseValueDelimiter
2020-07-02 05:02:28 +03:00
bors[bot]
9fc8ec965e
Merge #1995
...
1995: Move to terminal_size dep after the recent textwrap upgrade r=CreepySkeleton a=pksunkara
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-07-01 10:00:24 +00:00
Pavan Kumar Sunkara
e68ec35a90
Move to terminal_size dep after the recent textwrap upgrade
2020-07-01 09:46:10 +02:00
bors[bot]
e926c29960
Merge #1992
...
1992: fix(clap_derive): Unwrap `syn::TypeGroup` when checking field types r=CreepySkeleton a=Aaron1011
Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
2020-06-30 09:12:49 +00:00
bors[bot]
9ed8fccebe
Merge #1994
...
1994: Update to textwrap 0.12 r=CreepySkeleton a=sdroege
Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
2020-06-30 08:52:54 +00:00
Sebastian Dröge
1061354f17
Update to textwrap 0.12
2020-06-30 10:56:25 +03:00
Aaron Hill
c837b28552
fix(clap_derive): Unwrap syn::TypeGroup
when checking field types
...
Due to macro expansions, a `syn` type may be wrapped in multiple
'layers' of `syn::Type::Group`. However, `clap_derive` currently does
not check for `syn::Type::Group`, which will cause an `Option` (along
with other matched types) to fail to be detected when it results from a
macro expansion.
This commit 'unwraps' outer type groups before checking the
user-provided types against well-known types. Currently, these groups
may not be present due to a rustc bug (rust-lang/rust#43081 )
However, once https://github.com/rust-lang/rust/pull/73084 is merged,
these groups will be present in more cases. This commit makes `clap`
compatible with both older and newer versions of rustc.
2020-06-29 11:25:55 -04:00
bors[bot]
5ca8dfb17d
Merge #1991
...
1991: docs: switch debug and verbosity args in macro example r=pksunkara a=rleppink
Co-authored-by: Ronald Leppink <rleppink@users.noreply.github.com>
2020-06-28 18:56:26 +00:00
Ronald Leppink
036ba49ccf
docs: switch debug and verbosity args in macro example
...
The other examples have `verbosity` as a default arg, and `debug` as a `test` subcommand arg. The macro example has these two switched up -- this corrects that.
2020-06-28 14:34:48 +02:00
Kitlith
6eae5ed560
tests(subcommands): subcommand placeholder in help label
2020-06-27 20:19:57 -07:00
Kitlith
6d083f5653
imp(subcommands): "SUBCOMMANDS" label affected by subcommand placeholder
2020-06-27 14:21:17 -07:00
CreepySkeleton
a3206197ff
cargo clippy + fmt
2020-06-27 04:30:02 +03:00
CreepySkeleton
f904bebd9a
Ditch find_subcnd*! and match_alias!
2020-06-27 04:30:02 +03:00
CreepySkeleton
f143b2f70e
Ditch names! and sc_names!
2020-06-27 04:30:02 +03:00
CreepySkeleton
a9b022d777
Ditch longs!
2020-06-27 04:30:02 +03:00
CreepySkeleton
270fd55f60
Ditch groups_for_arg!
2020-06-27 04:30:02 +03:00
CreepySkeleton
b7be22e90b
Ditch opts! and positionals!
2020-06-27 04:30:01 +03:00
CreepySkeleton
f46af5b96b
Ditch flags!
2020-06-27 04:30:01 +03:00
bors[bot]
ca27d50ab2
Merge #1975
...
1975: fix: Use character instead of string for Arg::Short r=CreepySkeleton a=lanesawyer
Co-authored-by: Lane Sawyer <github@lanesawyer.dev>
2020-06-27 01:14:20 +00:00
bors[bot]
f72b728ed7
Merge #1987
...
1987: fix(justfile): rustup uses 'component add' instead of 'add component' r=pksunkara a=kitlith
Co-authored-by: Kitlith <kitlith@kitl.pw>
2020-06-26 16:12:24 +00:00
Kitlith
be20c2afa9
fix(justfile): rustup uses 'component add' instead of 'add component'
2020-06-25 19:43:17 -07:00
Kitlith
e5c66e58a6
Add test for custom subcommand placeholder text
2020-06-25 18:21:28 -07:00
Kitlith
3d406400ec
Allow changing the "SUBCOMMAND" placeholder text in usage ( #1597 )
2020-06-25 17:27:25 -07:00
bors[bot]
d663e6734d
Merge #1980 #1985
...
1980: Removed word duplicate from docs for allow_hyphen_values r=pksunkara a=kamilogorek
1985: docs(README.md): Fixes typo at line 413 r=CreepySkeleton a=ewilazarus
Co-authored-by: Kamil Ogórek <kamil.ogorek@gmail.com>
Co-authored-by: Gabriel Lima <ewilazarus@users.noreply.github.com>
2020-06-25 22:31:00 +00:00
bors[bot]
836072be95
Merge #1983
...
1983: Fix the external command subtype check r=CreepySkeleton a=lu-zero
Co-authored-by: Luca Barbato <lu_zero@gentoo.org>
2020-06-25 22:12:52 +00:00
Gabriel Lima
0512e7cea6
docs(README.md): Fixes typo at line 413
...
Fixes issue #1984
2020-06-25 10:01:52 -03:00
Luca Barbato
081f3e865c
Fix the external command subtype check
2020-06-25 13:52:14 +02:00
Kamil Ogórek
ef162afd4b
Removed word duplicate from docs for allow_hyphen_values
2020-06-22 16:52:27 +02:00
Lane Sawyer
392effe319
fix: Use character instead of string for Arg::Short
...
This PR switches the Arg::Short macro to take a character instead of a string. It removes the hacky code in the Method to_token method and implements the logic for Short when parsing the clap derive arguments.
Fixes #1815 .
2020-06-17 09:45:05 -07:00
NickHackman
d785ebc14e
fix: Flag Subcommands tests behind debug_asserts
...
Tests that check conflicts are behind the `debug_assertions` feature
2020-06-17 01:53:53 -04:00
NickHackman
32db427706
fix: duplicate short flags in Flag Subcommand test
2020-06-17 01:14:48 -04:00
NickHackman
f7c5b098b9
fix: duplicate flags in Flag Subcommand test
2020-06-17 00:56:05 -04:00
NickHackman
b09afcf653
fix: Gate fmt::Display
for Flag w/ debug_asserts
...
Implementation of `fmt::Display` for `Flag` caused tests to fail when
not ran with `debug_assertions` feature.
2020-06-17 00:09:25 -04:00
NickHackman
bf3d947f01
fix: Flag Subcommands conflicts panic
...
Conflicts with Flag subcommands and Args now panics when
`debug_assertions` is enabled, rather than causing bizarre behavior.
2020-06-16 23:45:21 -04:00
NickHackman
806d7487c6
example: updated 23 docs & refractor
...
Improved printing instead of printing out the `Vec` using `{:?}`,
`join(", ")` for improved printing. Improved documentation to b emore
explicit and apply to removal of `FlagSubCommand` -> `App::short_flag`
and `App::long_flag`
2020-06-16 20:01:19 -04:00
NickHackman
02ebf4f816
fix: display visible short flags, visible flags
...
Flags weren't being set as visible in one instance. Flags were not being
printed in help message.
2020-06-16 01:13:58 -04:00
NickHackman
383606e099
tests: short_flag_alias
methods
...
Tests that cover all methods for `short_flag_alias` corresponding methods
2020-06-16 01:11:53 -04:00
NickHackman
acb2f755f8
api: short_flag_aliases and corresponding methods
...
Aliases exclusively for `App::short_flag` that allow visible and hidden
short flag subcommands.
2020-06-16 00:13:21 -04:00