Commit graph

3277 commits

Author SHA1 Message Date
bors[bot]
1dd3fcb954
Merge #2019
2019: tests(validators): Add tests for `clap_app!` macro and `FromStr` trait validator r=pksunkara a=nickelc



Co-authored-by: Constantin Nickel <constantin.nickel@gmail.com>
2020-07-19 10:28:03 +00:00
bors[bot]
caa7bc6a15
Merge #2024
2024: Fix various typos in docs & code r=pksunkara a=intgr



Co-authored-by: Marti Raudsepp <marti@juffo.org>
2020-07-19 10:04:37 +00:00
Marti Raudsepp
594c535ba2 Fix various typos in docs & code
Most errors detected and fixed with Topy (https://github.com/intgr/topy),
all verified by hand.
2020-07-19 03:10:28 +03:00
Constantin Nickel
066d745653 tests(validators): Add tests for clap_app! macro and FromStr trait 2020-07-18 17:47:11 +02:00
bors[bot]
ff6beebd6e
Merge #1974
1974: Flag subcommands r=CreepySkeleton a=NickHackman



Co-authored-by: NickHackman <snickhackman@gmail.com>
Co-authored-by: Nick Hackman <31719071+NickHackman@users.noreply.github.com>
2020-07-18 14:06:50 +00:00
NickHackman
6c6b9db45c fix: clippy lint warning - name change
Lint name changed clippy::block_in_if_condition_stmt -> clippy::block_in_if_conditions
2020-07-16 18:05:25 -04:00
NickHackman
21436398a2 docs: improved flag subcommand documentation
Improved documentation in flag subcommand example and in
`App::short_flag` and `App::long_flag` method documentation.
2020-07-16 17:48:00 -04:00
bors[bot]
48d308a8ab
Merge #2010
2010: feat(macros): Add `@global $setting` to set global settings r=pksunkara a=nickelc



Co-authored-by: Constantin Nickel <constantin.nickel@gmail.com>
2020-07-14 18:39:26 +00:00
Constantin Nickel
fbfbf8df99 feat(macros): Add @global_setting $setting to set global settings 2020-07-13 15:13:04 +02:00
NickHackman
0ddd58c935 fix: clippy lint warning
Not necessary to borrow the to_string for comparison
2020-07-11 15:21:53 -04:00
NickHackman
6ddf940ac3 fix: conflicts between flag scs and args alias
When debug_assertions flag is active, properly handles conflicts between
flag subcommands short and long their aliases and args and their
aliases prevents self conflicts where the alias and the flag subcomand
were the same.
2020-07-11 15:01:18 -04:00
NickHackman
432be5bc30 tests: conflicts with flag sc and arg aliases
Tests to check for conflicts between flag subcommands long and short and
their aliases and args both long and short and their aliases. Tests to
handle self conflicts, where a flag subcommand short or long with have a
corresponding alias with the same value.
2020-07-11 15:00:40 -04:00
NickHackman
cf9265d660 fix: failing doc test 2020-07-10 09:36:39 -04:00
NickHackman
5118cec1b1 fix: long_flag_aliases instead of using alias
Previously long_flag alias checks were against normal aliases instead of
specifically designated long_flag aliases, this is more clear and explicit.
2020-07-10 09:27:14 -04:00
NickHackman
f5aabfa482 style: rename short, long -> short_flag, long_flag
These names are more explicit about what short and
long flag subcommands are.
2020-07-10 08:52:13 -04:00
bors[bot]
d8fccdb0ea
Merge #1986
1986: Custom subcommand placeholders r=pksunkara a=kitlith



Co-authored-by: Kitlith <kitlith@kitl.pw>
2020-07-10 12:51:30 +00:00
bors[bot]
608b982bbe
Merge #1997
1997: Cleanup setings r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-07-10 09:53:47 +00:00
NickHackman
0a266f8c8c fix: merge related issues
get_subcommands() now returns an impl Iterator rather than a slice,
match_alias! removed
2020-07-09 22:15:48 -04:00
Nick Hackman
27441329f9
Merge branch 'master' into flag-subcommands 2020-07-09 21:31:13 -04:00
NickHackman
a3f8ddb0b0 doc: removed '[``]' from documentation 2020-07-08 21:46:00 -04:00
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