Commit graph

4379 commits

Author SHA1 Message Date
Ed Page
8e780e364d fix(parser): Allow multiple_occurrecnes with positional args
This unblocks
- Defining repeated tuples in positional arguments
- Potentially using this in #1772

Fixes #2784
2021-10-04 12:09:54 -05:00
patrick-gu
edd0124af0
Fix disabling the default help and version subcommands/flags (#2796)
* Check for `DisableHelpFlag` along with `NoAutoHelp`

Also applies for `DisableHelpSubcommand` and `DisableVersionFlag` with `NoAutoVersion`

* Add tests for overriding help and version, and disabling version.

These override by disabling the default and adding a new one.

* Don't use `default_missing_value` for `override_version_using_short`

* Check errors by the API.

This changes the `disabled_version_long` and `disabled_version_short` tests.

This is opposed to comparing the stderr output.
2021-10-04 15:01:09 +01:00
Ed Page
236cf584cf
Merge pull request #2800 from ModProg/ArgValue-derive
Rename `ArgEnum::arg_value` to `to_arg_value`
2021-10-01 10:27:00 -05:00
ModProg
08e8c53862 refactor(ArgEnum): replace unwrap with except, arg_value -> to_arg_value 2021-10-01 16:14:10 +02:00
Ed Page
3b2e3ffddf
Merge pull request #2762 from ModProg/ArgValue-derive
ArgValue derive
2021-10-01 08:43:40 -05:00
ModProg
47ff3ed945 documentation for ArgValue 2021-09-29 20:55:47 +02:00
ModProg
d53778ed5d fix ui 2021-09-29 19:31:05 +02:00
ModProg
15fcf814c2 fix dummies 2021-09-29 19:05:16 +02:00
ModProg
480035ac9c ArgEnum: Slice instead of array, from_str in ArgEnum implemented 2021-09-29 18:33:43 +02:00
Pavan Kumar Sunkara
5940bb2360
Merge pull request #2794 from ldm0/simplify
Less format & branch
2021-09-28 22:21:09 +01:00
ModProg
ac1a9d6d13 address epage's remarks 2021-09-27 22:06:17 +02:00
liudingming
3206db99af less format macro, less branches. 2021-09-27 23:34:13 +08:00
ModProg
76f7211d8b small changes 2021-09-27 01:29:10 +02:00
ModProg
f002cdcc99 move alias implementation to ArgValue for derive 2021-09-27 01:18:47 +02:00
ModProg
d3f0534939 add hidden aliases to ArgValue 2021-09-26 22:46:23 +02:00
Pavan Kumar Sunkara
a9bd06945a
Merge pull request #2793 from ldm0/master
Resolve a todo
2021-09-26 21:04:09 +01:00
liudingming
7ba46400e4 Resolve a todo 2021-09-27 02:03:28 +08:00
Roland Fredenhagen
88d7d02555 Working Implementation 2021-09-26 16:32:46 +02:00
ModProg
b589a6ce06 feat(derive:arg_enum): use ArgValue in ArgEnum trait 2021-09-26 16:32:46 +02:00
Pavan Kumar Sunkara
86fda8bacd
Merge pull request #2786 from jonathanmorley/assert-whitespace
assert on leading and trailing whitespace
2021-09-24 20:25:17 +01:00
Morley, Jonathan
1d3a292d6b assert on leading and trailing whitespace 2021-09-24 12:38:15 -04:00
Pavan Kumar Sunkara
f243bbf06d
Merge pull request #2781 from clap-rs/settings_bitor
Implement BitOr for settings
2021-09-24 16:14:51 +01:00
Pavan Kumar Sunkara
9c214a66dc
Merge pull request #2783 from cherryblossom000/elvish-completions-fix
Fix Elvish completions generation
2021-09-24 14:39:00 +01:00
cherryblossom
f77dceaf69
Fix Elvish completions generation
The `display-suffix` option for `edit:complex-candidate` was [deprecated in Elvish v0.14.0][1] and
removed in v0.15.0 (latest version is v0.16.3), so this commit changes the Elvish completions
generation to use the `display` option instead.

Additionally, this commit changes assignments to use the `var` and `set` keywords as using
`name = value` without these keywords ('legacy assignment form') [will be deprecated][2].

[1]: https://elv.sh/blog/0.14.0-release-notes.html
[2]: https://elv.sh/ref/language.html#legacy-assignment-form
2021-09-24 22:29:05 +10:00
Pavan Kumar Sunkara
bdc70c9fd9 Fix benchmarking issues 2021-09-23 17:17:15 +05:30
Pavan Kumar Sunkara
699a3f76d6 Implement BitOr for settings 2021-09-23 14:57:10 +05:30
Roland Fredenhagen
5580e8c465
ArgValue builder (#2758)
* feat(arg_value): ArgValue can be used for possible_values

Through the ArgValue it is possible:

* `hide` possible_values from showing in completion, help and validation
* add `about` to possible_values in completion

* Resolved a few change-requests by epage

* make clippy happy

* add ArgValue::get_visible_value

* remove verbose destructering

* rename ArgValue::get_hidden to ArgValue::is_hidden

* add test for help output of hidden ArgValues

* Documentation for ArgValue

There is an issue that required to implement From<&ArgValue> for
ArgValue. We should probably find a solution without that.

* fix requested changes by epage

* fix formatting

* add deref in possible_values call to remove From<&&str>

* make clippy happy

* use copied() instad of map(|v|*v)

* Finishing up for merge, hopefully

* changes requested by pksunkara
2021-09-19 10:29:09 +00:00
Pavan Kumar Sunkara
a42a97a566
Merge pull request #2775 from patrick-gu/master
Apply `value_delimiter` to default values
2021-09-19 00:55:39 +01:00
patrick-gu
d79c59ab17 Add test for default_missing_values with value_delimiter 2021-09-18 15:47:03 -07:00
patrick-gu
90dde89ec4 Apply value_delimiter to default values 2021-09-18 15:15:25 -07:00
Pavan Kumar Sunkara
c4780e3305
Merge pull request #2774 from epage/vec_map
refactor: Remove vec_map dependency
2021-09-18 11:38:46 +01:00
Ed Page
b3847b76c4 refactor: Remove vec_map dependency
Doesn't look like this dependency is buying us anything at this point,
so removing it.
2021-09-17 15:14:49 -05:00
Pavan Kumar Sunkara
76859b16bb
Merge pull request #2773 from tangmi/fix-large-display-order
Add test for very large display_order values and a possible fix
2021-09-17 19:39:37 +01:00
Pavan Kumar Sunkara
1937472e0f
Merge pull request #2771 from mustafa-guler/master
Fix bug with duplicate error messages
2021-09-17 19:28:43 +01:00
Mustafa Guler
50b9e65d39 Fix bug with duplicate error messages
This addresses a bug that causes duplicate flags reported in user-facing
error messages when two flags require one-another but also are required
under other conditions. The fix involves removing duplicates in unrolled
requirements, which addresses the user-facing aspect of this bug.
2021-09-17 10:47:06 -04:00
Michael Tang
cc592ed800 Add test for very large display_order values and a possible fix.
Fixes #2772
2021-09-16 19:11:30 -07:00
Pavan Kumar Sunkara
af7802a2ed
Merge pull request #2761 from ModProg/patch-1
doc(generate) fix link in `generate_to`
2021-09-09 16:35:12 +01:00
Roland Fredenhagen
c01df8da40
doc(generate) fix link in generate_to 2021-09-09 13:04:01 +02:00
Roland Fredenhagen
0105e6f0b8
fix(generate): Better subcommand completion in fish (#2726)
* fix(generate): Better subcommand completion in fish

* Prevent completing subcommands that were already completed

* Make sure all parent subcommands actually existent

Partially fixes #2715

* Added Test

* fix(generate) Improve subcommand testing

This now also disables the completion of sub_subcommands options for
subcommands.
2021-09-08 15:32:26 +01:00
Pavan Kumar Sunkara
d03638c0fd
Merge pull request #2751 from co42/derive_subcmd_name_not_literal
Allow subcmd name to be something else than a literal in clap derive
2021-09-07 08:40:54 +01:00
corentin.regal
8df90fbd0e Allow subcmd name to be something else than a literal in clap derive 2021-09-06 09:13:20 +02:00
patrick-gu
044f9c5669
Don't suggest help or --help when not applicable (#2749)
* Don't suggest `help` or `--help` when not applicable

* Apply suggestions from code review

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>

* Update test usage to match intended

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-09-04 20:10:24 +00:00
Pavan Kumar Sunkara
b8ceab3e6f Fixes #2736 2021-09-04 15:04:09 +05:30
Pavan Kumar Sunkara
dae86f456e
Merge pull request #2744 from dylni/replace-arg-str-with-raw-os-str
Replace `ArgStr` with `os_str_bytes::RawOsStr`
2021-08-31 21:19:02 +01:00
Emmanuel Leblond
15b9ff1a24
Add placeholders for Cookbook and Cheatsheet pages in the website (#2732)
* Add placeholders for Cookbook and Cheatsheet pages in the website

* Update site/content/cheatsheet.md

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-08-31 11:13:21 +00:00
Pavan Kumar Sunkara
09ec8bd1db
Merge pull request #2747 from svenstaro/fix-keyvalue-example
Fix keyvalue example
2021-08-30 05:00:02 +01:00
Sven-Hendrik Haase
2f8f55e64b
Fix keyvalue example
This was broken earlier due to 3f94d17c71 not
taking into account this example.

Fixes #2746.
2021-08-30 04:52:35 +02:00
dylni
6311c894cc Fix compile errors 2021-08-29 10:24:56 -04:00
dylni
a50591b16b Fix warnings 2021-08-29 10:10:26 -04:00
dylni
dc65513966 Replace ArgStr with os_str_bytes::RawOsStr 2021-08-29 10:00:30 -04:00