Commit graph

4070 commits

Author SHA1 Message Date
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
Pavan Kumar Sunkara
7a5b7b0ada
Merge pull request #2285 from mgeisler/str-width-count-chars
feat: count chars instead of bytes in str_width
2021-02-20 21:06:24 +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
Pavan Kumar Sunkara
0f92d5f2c3
Merge pull request #2352 from ldm0/all
Add --all-features for CI, fix build with debug feature.
2021-02-18 20:39:43 +00:00
ldm0
2d26f02605 Add --all-features for CI, fix build with debug feature. 2021-02-17 04:37:08 +00:00
ldm0
3873b647d1 Add tests for 2229 2021-02-16 03:58:58 +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
7b2be47de7
Merge pull request #2348 from ldm0/non_fmt_panic_fix
Bump version-sync version
2021-02-14 11:15:40 +00:00
ldm0
a684e9a51d Bump version-sync version 2021-02-14 09:51:23 +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
90005de353
Merge pull request #2339 from clap-rs/settings
Remove Arg::settings to be consistent with App
2021-02-12 17:31:08 +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
97343e4cef
Merge pull request #2340 from ldm0/ci
Fix CI on i686-unknown-linux-gnu
2021-02-12 08:20:30 +00:00
ldm0
5997626c41 Fix CI on i686-unknown-linux-gnu 2021-02-12 04:41:29 +00:00
Pavan Kumar Sunkara
8eb5081b53 Update changelog 2021-02-10 23:33:14 +00:00
Pavan Kumar Sunkara
f95a79dea4
Merge pull request #2336 from clap-rs/hidden_help
Better help message support for hidden and heading stuff
2021-02-08 06:02:54 +00:00
Pavan Kumar Sunkara
9aea23ca30
Merge pull request #2211 from clap-rs/mut_arg
Prefer mut_arg over help_about and version_about
2021-02-08 05:22:37 +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
05ab92702d
Merge pull request #2297 from ldm0/parser
Parser refactor.
2021-02-07 15:11:09 +00:00
Pavan Kumar Sunkara
c9cb22905c Build help and version args at the beginning 2021-02-07 14:46:38 +00:00
ldm0
560aa536df Change tests prefix 2021-02-07 05:59:29 +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
Pavan Kumar Sunkara
440cee8ff5
Merge pull request #2329 from ldm0/dash
Fix eagerly trimming dash in parse_long_flag
2021-02-06 16:50:45 +00:00
ldm0
1000c9fb03 Fix eagerly trimming dash in parse_long_flag 2021-02-06 11:26:20 +00:00
Pavan Kumar Sunkara
3b59f5d369
Merge pull request #2328 from ldm0/parser2
Parsing function clean up
2021-02-05 19:10:38 +00:00