Donough Liu
0394ae6102
Fix handling of number_of_values
when displaying arg ( #2701 )
...
* Remove dead logic
* Outline common logic
* Fix issue 1571
2021-08-17 09:17:18 +00:00
Pavan Kumar Sunkara
9dd75987df
Remove TakesValue restriction for HideEnv*
2021-08-15 19:40:24 +01:00
Pavan Kumar Sunkara
203613d5e3
Merge pull request #2696 from ldm0/override
...
Make `overrides_with` working when `MultipleValues` is enabled.
2021-08-14 10:41:40 +01:00
liudingming
a85857dfb0
Make overrides_with working when MultipleValues
is enabled.
2021-08-14 16:34:26 +08:00
Pavan Kumar Sunkara
441ff68c2d
Merge pull request #2694 from clap-rs/env-feature
...
Add env feature gate
2021-08-14 03:11:21 +01:00
Pavan Kumar Sunkara
c7985fb73e
Add env feature gate
2021-08-14 01:55:05 +01:00
Pavan Kumar Sunkara
61eb921f63
Fix value_names & num_vals interaction
2021-08-14 01:08:44 +01:00
liudingming
a60836d96a
Make value_delimiter
accept char rather than String
2021-08-14 02:54:56 +08:00
Pavan Kumar Sunkara
476dd190b7
Merge pull request #2682 from clap-rs/checker
...
Set TakesValue to true for positional args when building
2021-08-12 22:46:15 +01:00
Pavan Kumar Sunkara
b4a662b6c9
Set TakesValue to true for positional args when building
2021-08-12 21:27:42 +01:00
Steven Engler
1bd63feffe
Hide help heading when all args are hidden
2021-08-12 00:51:58 +01:00
rami3l
5f781c72a5
feat(parser): accept non-false
literals with env vars as true
2021-08-10 12:21:12 +02:00
rami3l
f2f9b665ed
feat(parser): accept boolean literal with env vars, take 1
2021-08-10 12:21:02 +02:00
liudingming
e851a82080
Move pos_counter before parsing flags.
...
Then checking if AllowHyphenValues is set when parsing flag is possible.
2021-08-08 03:38:41 +08:00
rami3l
ac12c30352
fix(style): allow bool_assert_comparison
in default_missing_value_flag_value
2021-08-02 23:10:51 +02:00
rami3l
d7c984896d
fix(style): remove unnecessary usages of 'static
and ref
2021-08-02 23:05:21 +02:00
Pavan Kumar Sunkara
4bec66dd03
Merge pull request #2619 from rami3l/flag-literal
...
fix(parser): Ban long flags with literals
2021-08-01 12:31:29 +01:00
rami3l
d848c88773
fix(test): fix typo in flag_using_long_with_literals
2021-08-01 12:19:00 +02:00
rami3l
2b3fc4d0b6
test: simplify flag_using_long_with_literals
2021-08-01 11:57:44 +02:00
liudingming
ab119b342a
Fix value_of returns None when the first value group is empty
2021-08-01 03:56:23 +08:00
patrick-gu
88dec14775
Fix order of arguments in help message with AllowMissingPositional ( #2648 )
...
* Fix small formatting error
I accidentally introduced this in #2642
* Fix order of arguments in help message with AllowMissingPositional
2021-07-31 07:39:23 +01:00
rami3l
87479dfb8c
fix: ban all uses of literals with flags
2021-07-30 22:33:56 +02:00
rami3l
2d2db652ef
fix: fix #1649 , take 1
2021-07-30 22:33:56 +02:00
liudingming
a419f25fdb
Fix issue, add tests
2021-07-30 15:39:34 +08:00
patrick-gu
a4dc72ed19
Replace "Prints" with "Print" for default help and version commands
2021-07-29 20:23:25 -07:00
Pavan Kumar Sunkara
5fbd764b06
Merge pull request #2622 from patrick-gu/master
...
Refactor creation of `App` and `Arg` from YAML
2021-07-27 10:31:55 +01:00
patrick-gu
9b64ac2b45
Refactor creation of App
and Arg
from YAML
...
Improved the `impl`s of `From` for `&'help Yaml` to use expects with useful messages instead of unwraps. Also made changes to avoid potentially fetching redundant data from YAML hashes and unwrapping the same data multiple times. Finally, there are tests to ensure the panics are correct.
2021-07-25 15:24:43 -07:00
Pavan Kumar Sunkara
27311139c2
Merge pull request #2610 from ldm0/value_name
...
Print `value_name` `number_of_values` times with single value_name
2021-07-25 14:23:21 +01:00
liudingming
62fa1e7454
Print value_name
number_of_values
times with single value_name
2021-07-21 03:38:58 +08:00
liudingming
6094520541
Don't show default_val in smart usage
2021-07-21 02:50:41 +08:00
anatawa12
89d1519f69
Show summary in subcommands list ( #2558 )
...
* Show short about in SUBCOMMANDS list
* add tests
* move test
* cargo fmt
2021-06-20 16:28:50 +01:00
Ethan Budd
6a48698fcd
Add a new arg option for the max_occurrences ( #2543 )
...
* add a new arg option for the max_occurrences
* check ErrorKind in tests
* Updated grammer in doc comments
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
* assert is_err() before unwraping
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-06-17 19:54:24 +01:00
Pavan Kumar Sunkara
947523f7f5
Merge pull request #2480 from kolloch/feature/partial-parsing
...
setting: IgnoreErrors - Allow parsing despite missing option values
2021-06-16 09:09:52 +01:00
Pavan Kumar Sunkara
e5e20b389e
Forbid multiple_occurrences for positional args
2021-06-16 08:27:04 +01:00
Pavan Kumar Sunkara
3f94d17c71
Removed Arg::multiple
2021-06-16 07:17:11 +01:00
Peter Kolloch
171dcbe424
setting: IgnoreErrors - Reaction to review comments
...
https://github.com/clap-rs/clap/pull/2480
2021-06-14 10:26:23 +02:00
Peter Kolloch
c50d338962
setting: IgnoreErrors - Allow parsing despite missing option values
...
Implemented as AppSetting::Ignore errors as suggested by
@CreepySkeleton in
https://github.com/clap-rs/clap/issues/1880#issuecomment-637779787 .
This is not a complete implementation but it works already in
surprisingly many situations.
https://github.com/clap-rs/clap/issues/1880
2021-06-14 10:26:18 +02:00
Terts Diepraam
834f600a6f
infer long arguments
2021-06-05 13:18:06 +02:00
Pavan Kumar Sunkara
82e42cd07e
Ignore extra fields in YAML only when specified
2021-06-01 21:59:44 +01:00
rami3l
fbd338ce26
fix: flag_subcommands
unexpected behavior after long arg ( #2501 )
...
* fix(wip): add necessary debugging prints for analysis
* fix(wip): implement the fix, take 1
* docs: add docstring for `Parser::flag_subcmd_at` and `Parser::flag_subcmd_skip`
* test: make `flag_subcommand_short_after_long_arg` test more realistic
2021-05-27 05:14:50 +05:30
Pavan Kumar Sunkara
6a395d3208
ArgMacthes::is_present should not deal with subcommands at all, fixes #2494
2021-05-26 00:40:38 +01:00
Ajeet D'Souza
5809ae6060
feat: Add AppSettings::DisableEnv ( #2493 )
...
* Add DisableEnv flag
* Apply formatting
* Add tests
2021-05-21 00:47:47 +05:30
Ajeet D'Souza
460459c771
fix(usage): Move positional args to end of usage string ( #2492 )
...
* Move positional args to end of USAGE
* Remove -- from usage string
2021-05-21 00:29:21 +05:30
Pavan Kumar Sunkara
abe2373cca
Merge pull request #2026 from zkat/master
...
feat(derive): Add support from inheriting global options in subcommands
2021-05-20 13:52:24 +01:00
Felipe Sere
03d4989ef9
Replicate the derive test for from_global
2021-05-18 22:21:18 +01:00
Eldritch Cheese
fa991754d3
imp(validator): Case-insensitive required_if_eq when arg is case-insensitive
2021-05-15 09:45:24 -07:00
Donough Liu
2a921d4cda
Fix clippy warnings.
2021-05-07 19:05:18 +00:00
liudingming
a995e5a204
Add yaml multiple_* tests
2021-05-07 14:34:03 +08:00
sharnoff
47aaca1e5d
change 'tests/macros.rs' to not import clap_app!
...
This should help to guard against future errors where `clap_app!` refers
to itself without the required "$crate::" prefix
2021-04-27 11:21:54 -07:00
Reagan McFarland
b184dc001b
setting: SubcommandHelpShowsLongForm implemented
...
Refactoring and better test cases
Refactored SubcommandHelpShowsLongForm to
UseLongFormatForHelpSubcommand.
Tests and docuemntation examples use about and long_about instead of
(before/after)_help.
Removed commented out tests
Linting: Fix trailing new line
Updated change log, refactored tests and doc str
Reordered items in the Changelog
New test added and old tests removed that were redundant
Doc string for AppSettings::UseLongFormatForHelpSubcommand fixed
2021-04-11 14:31:40 -04:00