Commit graph

3304 commits

Author SHA1 Message Date
CreepySkeleton
18a58af3ac Allow validators to be FnMut 2020-08-12 02:39:59 +03:00
CreepySkeleton
790a0f5e62 Make sure that App & Arg & ArgGroup implement Send + Sync
Also relaxes 'static restriction on validators.
2020-08-12 02:39:59 +03:00
bors[bot]
da92a32d10
Merge #2048
2048: Change the ret tyte of Argmatches::subcommand r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-11 00:20:35 +00:00
bors[bot]
6492ae2353
Merge #1793
1793: Add hinting of arg value types for zsh/fish completion r=CreepySkeleton a=intgr



Co-authored-by: Marti Raudsepp <marti@juffo.org>
2020-08-07 18:14:01 +00:00
Marti Raudsepp
64ee0f8009 Add hinting of arg value types for zsh/fish completion
Adds new method/attribute `Arg::value_hint`, taking a `ValueHint` enum
as argument. The hint can denote accepted values, for example: paths,
usernames, hostnames, commands, etc.

This initial implementation supports hints for the zsh and fish
completion generators, support for other shells can be added later.
2020-08-06 22:17:31 +03:00
CreepySkeleton
f0044d205d Remove a redundant lifetime 2020-08-05 22:33:51 +03:00
CreepySkeleton
e6cc49ecde Adjust derive 2020-08-05 17:07:13 +03:00
CreepySkeleton
e9759a241b Adjust examples and tests 2020-08-05 17:07:13 +03:00
CreepySkeleton
6dcf93be00 Change the return type of ArgMatches::subcommand() 2020-08-05 13:35:42 +03:00
bors[bot]
a4bc1f2abc
Merge #2038
2038: Improve iterator use r=CreepySkeleton a=nnethercote



Co-authored-by: Nicholas Nethercote <nnethercote@mozilla.com>
2020-07-29 02:14:00 +00:00
Nicholas Nethercote
ed46e8962c refactor: Combine two large and very similar expressions. 2020-07-29 10:35:36 +10:00
Nicholas Nethercote
7fb397d905 refactor: Simplify some it.any(...) calls. 2020-07-29 10:35:34 +10:00
Nicholas Nethercote
be535e28cf refactor: Avoid unnecessary uses of enumerate(). 2020-07-29 10:35:31 +10:00
Nicholas Nethercote
d8c775eb26 refactor: Replace it.filter(...).find(...) with it.find(...). 2020-07-29 10:35:27 +10:00
Nicholas Nethercote
217b111bd7 refactor: Replace it.find(...).is_none() with !it.any(...). 2020-07-29 10:35:22 +10:00
bors[bot]
dbdd63b350
Merge #2016
2016: imp(errors): Provide the missing required arguments as info r=CreepySkeleton a=nickelc



Co-authored-by: Constantin Nickel <constantin.nickel@gmail.com>
2020-07-26 08:08:35 +00:00
bors[bot]
dda961b715
Merge #2027
2027: style: rename ErrorKind::{VersionDisplayed, HelpDisplayed} to present tense r=CreepySkeleton a=siyopao



Co-authored-by: Craig Pastro <siyopao@gmail.com>
2020-07-26 07:36:52 +00:00
bors[bot]
dd5e6b2313
Merge #2025
2025: Make lifetimes descriptive r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-07-21 16:30:08 +00:00
CreepySkeleton
37c1631f06 Make lifetimes descriptive 2020-07-21 18:59:07 +03:00
bors[bot]
1d57aa2ffb
Merge #2030
2030: style: replacing yml with yaml for consistency r=pksunkara a=marcospb19



Co-authored-by: João Marcos <marcospb19@hotmail.com>
2020-07-21 13:11:15 +00:00
bors[bot]
aab97614ed
Merge #2020
2020: Implementation of feature request #1918 r=pksunkara a=leo-lb



Co-authored-by: Léo Le Bouter <lle-bout@zaclys.net>
2020-07-21 09:47:23 +00:00
João Marcos
24760bc261 style: replacing yml with yaml for consistency 2020-07-20 20:58:34 -03:00
Léo Le Bouter
eabe8b67b4 Implementation of feature request #1918 2020-07-20 15:35:40 +02:00
Craig Pastro
866f2edbed style: rename ErrorKind::{VersionDisplayed, HelpDisplayed} to present tense 2020-07-20 10:27:07 +09:00
bors[bot]
dc363d0b91
Merge #2008
2008: feat: Added {before/after}_help_long to App struct, closed #1903 r=pksunkara a=Blaxar



Co-authored-by: Blaxar Waldarax <blaxar.waldarax@gmail.com>
2020-07-19 12:28:09 +00:00
Blaxar Waldarax
748aea39f3 feat: Added {before/after}_help_long to App struct, closed #1903 2020-07-19 13:59:53 +02:00
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
Constantin Nickel
6fe48fd51f imp(errors): Provide the missing required arguments as info 2020-07-15 00:52:06 +02: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