Commit graph

1685 commits

Author SHA1 Message Date
Logan SQUIREL
f74af655ce
Apply @pksunkara review 2021-02-22 09:37:29 +01:00
Logan SQUIREL
22b5d34693
imp: Visible aliases for arguments in completions (#2335)
Following changes are implemented:

- Add 'clap::Arg::get_visible_aliases(&self)' method
  This new method provides access to visible argument aliases
- Add 'clap::Arg::get_short/long_and_visible_aliases
  This new method provides access to the short/long arguments and its
  visible aliases
- Add visible aliases completions in clap_generate for following shells:
  - Bash
  - Elvish
  - Fish
  - Powershell
  - Zsh
- Add test fixtures for testing visible alias completions in clap_generate:
  'clap_generate/tests/completions/<shell>::<shell>_with_aliases()'
2021-02-22 09:36:08 +01:00
Pavan Kumar Sunkara
1602b103cd
Fix typo in crate_license docs 2021-02-20 22:08:48 +00:00
Martin Geisler
df7a8c1282 feat: remove direct unicode-width dependency
This removes the direct dependency on unicode-width and delegates the
complexity of computing the displayed width of text to the Textwrap
crate.

The `display_width` function handles characters like “æøå” (Danish),
“äöü” (German), and “😂😍” (emojis) – even if the unicode-width
Cargo feature is disabled.

This is an improvement of the former `str_width` function which would
over-estimate the width of emojis and non-ASCII characters (since they
are several bytes wide).
2021-02-20 20:56:15 +01:00
Pavan Kumar Sunkara
80cbc1e695
Merge pull request #2350 from ldm0/num_vals
Change how num_vals, min_vals, max_vals interacts with Multiple*
2021-02-18 21:07:26 +00:00
ldm0
2d26f02605 Add --all-features for CI, fix build with debug feature. 2021-02-17 04:37:08 +00:00
ldm0
28b58af63b Change to num_vals, min_vals, max_vals interacts with Multi* 2021-02-16 03:45:20 +00:00
Collin Styles
2b45011c9b
Update docs for required_unless_present_any (#2347)
* docs: Correct method name in example

This looks like it was copied from the documentation for
`required_unless_present_all` but not updated accordingly for this
method.

* docs: Add note re `required_unless_present_all` to `required_unless_present_any`

There's a note in the documentation for `required_unless_present_all`
telling users to check out `required_unless_present_any` if that's what
they want. I figured it might be useful to have a similar note in the
documentation for `required_unless_present_any` pointing to that method
as well.

* docs: Fix `required` link in docs for `required_unless_present_all`

* docs: Correct "if" to "unless"
2021-02-15 08:20:11 +00:00
ldm0
73c682b652 Small code shrinking 2021-02-14 13:07:21 +00:00
ldm0
5cff16b6f9 Limit usage of inc_occurence_of 2021-02-14 11:21:12 +00:00
ldm0
78d7252b03 Remove Parser::need_more_vals 2021-02-14 11:21:12 +00:00
Pavan Kumar Sunkara
a8c9d28ead
Merge pull request #2346 from ldm0/non_fmt_panic_fix
Fix part of the non_fmt_panic warnings, bump version-sync to 0.9.2
2021-02-14 01:58:26 +00:00
Pavan Kumar Sunkara
5025ed3bee
Merge pull request #2345 from ldm0/usize
Change some u64 to usize
2021-02-14 01:57:53 +00:00
ldm0
ddb53af5dc Change some u64 to usize 2021-02-13 15:25:40 +00:00
ldm0
580d8d2c63 Fix part of the non_fmt_panic 2021-02-12 17:35:15 +00:00
Pavan Kumar Sunkara
6634444c3c Remove Arg::settings to be consistent with App 2021-02-12 10:42:38 +00:00
Pavan Kumar Sunkara
8eb5081b53 Update changelog 2021-02-10 23:33:14 +00:00
Pavan Kumar Sunkara
2b5a23597a Better help message support for hidden and heading stuff 2021-02-08 05:22:27 +00:00
Pavan Kumar Sunkara
3758bba5e2 Remove help_about in favor of mut_arg 2021-02-07 17:22:56 +00:00
Pavan Kumar Sunkara
b824e0b088 Allow nested subcommands mutated generated args to take preference 2021-02-07 16:28:49 +00:00
Pavan Kumar Sunkara
423e2dde00 Remove version_about in favor of mut_arg 2021-02-07 16:14:07 +00:00
Pavan Kumar Sunkara
1bd902370a Add tests for mut_arg on help and version 2021-02-07 15:54:24 +00:00
Pavan Kumar Sunkara
93a737a4fa
Merge pull request #2333 from clap-rs/build_help_and_version_at_start
Build help and version args at the beginning
2021-02-07 15:53:45 +00:00
Pavan Kumar Sunkara
c9cb22905c Build help and version args at the beginning 2021-02-07 14:46:38 +00:00
ldm0
899b04f481 Remove clone 2021-02-07 05:40:02 +00:00
ldm0
1494109795 Apply rename suggestions 2021-02-07 05:32:35 +00:00
ldm0
fb3033834b Change the way parser do self override 2021-02-07 04:46:56 +00:00
Donough Liu
58b9f35771 Add tests, fix grouped_values_of()
Fix clippy

type complexity fix
2021-02-07 04:46:56 +00:00
Donough Liu
451c5382cc Finish arg grouping logic 2021-02-07 04:46:56 +00:00
Donough Liu
b48ccff812 Better MatchedArg::ty 2021-02-07 04:46:56 +00:00
Donough Liu
fdafa3f02a More convenient MatchesArg functions 2021-02-07 04:46:56 +00:00
Donough Liu
7782a5eefc Insert vals group for default missing vals 2021-02-07 04:46:56 +00:00
Donough Liu
32e03a0dfe Better flow 2021-02-07 04:46:56 +00:00
Donough Liu
f1e9b82584 Implement nested vals 2021-02-07 04:46:56 +00:00
Donough Liu
9c52e454e8 Refactor MatchedArg::vals 2021-02-07 04:46:56 +00:00
Donough Liu
18549df845 Refactor MatchedArg::indices 2021-02-07 04:46:56 +00:00
ldm0
1000c9fb03 Fix eagerly trimming dash in parse_long_flag 2021-02-06 11:26:20 +00:00
Donough Liu
00cf697d36 Small simplification on several functions 2021-02-05 10:07:46 +00:00
Donough Liu
5e020c636d Remove had_eq 2021-02-05 10:07:46 +00:00
Donough Liu
751adaa687 Remove ContainsLast flag 2021-02-05 10:07:46 +00:00
Donough Liu
818f62bd5c Unused clippy allow 2021-01-30 17:39:34 +00:00
Donough Liu
45753d552b Resolve a TODO 2021-01-30 17:39:34 +00:00
Donough Liu
cf4881182a Add comments for some internal app settings 2021-01-30 17:39:34 +00:00
Donough Liu
c8e669c690 Eliminate unreachable branch
comment fix

Apply fmt
2021-01-30 17:39:33 +00:00
Donough Liu
944fc759c9 Optimize branch, more comments 2021-01-30 17:24:11 +00:00
Donough Liu
5774eb2c52 Simplify possible subcommand 2021-01-30 17:24:11 +00:00
Donough Liu
9cf007378b Branch simpification 2021-01-30 17:24:11 +00:00
Donough Liu
336f926ec9 Integrate workflow 2021-01-30 17:24:11 +00:00
Donough Liu
be314d9ac0 Flow optimize 2021-01-30 17:24:11 +00:00
Donough Liu
c39dcf2ecf Remove redundant ClapResult in some functions 2021-01-30 17:24:11 +00:00