shanmu
f7383f7d6d
feat(clap_complete): Add support --flag bar
and -f bar
completion
2024-07-23 18:18:30 +08:00
shannmu
932ca1356f
refactor(clap_complete): Replace parameters in complete_arg
with ParseState
2024-07-23 02:43:42 +08:00
shannmu
9220bbdeba
feat(clap_complete): Support hiding possible values
2024-07-19 11:30:36 -05:00
shannmu
d68c91af95
feat(clap_complete): Support hiding subcommands and their aliases
2024-07-19 11:20:16 -05:00
Ed Page
871005724d
Merge pull request #5583 from shannmu/hidden_flags_and_aliases
...
feat(clap_complete): Support hiding long flags and their long aliases
2024-07-19 11:18:22 -05:00
shannmu
d1e0f6073c
feat(clap_complete): Support hiding long flags and their long aliases
2024-07-19 22:49:35 +08:00
Ed Page
7f903005b8
Merge pull request #5586 from shannmu/glue_documentation
...
docs: Add document comments how to source dynamic completions
2024-07-19 09:29:32 -05:00
shannmu
43e17f2c2b
docs: Add document comments how to source dynamic completions
2024-07-19 22:04:12 +08:00
shannmu
67e31af334
refactor(clap_complete): Add CompletionCandidate
to replace (OsString, Option<StyledStr>)
2024-07-19 18:29:16 +08:00
shannmu
697b88e28f
feat(clap_complete): Add elvish support for native completion
2024-07-18 13:44:27 +08:00
Ed Page
4a8d6806d9
Merge pull request #5549 from shannmu/hidden_aliases
...
feat(clap_complete): Add support for visible subcommand aliases
2024-07-17 16:20:17 -05:00
shannmu
cef9393c5d
feat(clap_complete): Add zsh support for native completion
2024-07-17 23:29:48 +08:00
shanmu
152b2e8a55
feat(clap_complete): Add support for visible subcommand aliases
2024-07-16 16:26:52 +08:00
Lzu Tao
6243d65463
fix: Only generate stubs if has subcommands
2024-07-11 06:01:42 +07:00
Lzu Tao
76b9c46241
style: Prefer matching with enum name
2024-07-09 07:51:21 +07:00
Lzu Tao
0462be61cc
doc: Explain why we fallback to the old behavior
2024-07-09 07:40:11 +07:00
Lzu Tao
eba26a9376
chore: Explain why -lt 3 levels of subcommands
2024-07-09 06:56:31 +07:00
Lzu Tao
1dd1056cd7
fix: Check for real optional arguments
2024-07-07 07:27:47 +07:00
Lzu Tao
e276fc420b
fix: Fix conditions to generate helpers
...
Both should be met.
2024-07-07 00:26:53 +07:00
Lzu Tao
6c706d534b
chore: Use get_action to filter out help/version flags
2024-07-07 00:16:48 +07:00
Lzu Tao
2167fee212
fix(fish): Don't handle level 3 nested subcommand
...
Nested subcommand more than 3 levels is not practical in public.
Take rustup for example, `rustup toolchain install <version>`,
there is only 3 levels of nested subcommands. But there is also
the case of `rustup help toolchain install`, or `rustup toolchain help install`.
2024-07-06 07:58:43 +07:00
Lzu Tao
a6ac45f566
feat(fish): Support nested subcommand completion
2024-07-06 07:27:56 +07:00
Lzu Tao
5ee1a2570e
fix(fish): Don't ignore files if has positional args
2024-06-28 10:20:09 +07:00
Lzu Tao
1e3681bfbc
refactor: Pass list to __fish_seen_subcommand_from
2024-06-27 07:22:04 +07:00
Lzu Tao
b1a0508cf9
refactor: Rewrite iterator for followup changes
2024-06-27 07:21:18 +07:00
Lzu Tao
b16f987ad7
style: Escaping tab as \t for more readability for fish
2024-06-25 08:42:49 +07:00
Ed Page
b3effeae10
style: Make clippy happy
2024-06-13 12:45:33 -05:00
Ben Rogers
8e3c273b61
fix(zsh): Separate options from _arguments options
2024-06-07 15:20:04 -04:00
Pawel Zmarzly
5000d58f38
feat(complete): Add autocomplete for visible_alias
...
Let's generate autocompletions for aliased subcommands.
$ source before.zsh
$ clap-test [TAB] <- gives me "foo bar --"
$ clap-test foo [TAB] <- gives me "--my-flag"
$ clap-test bar [TAB] <- no reaction
$ source after.zsh
$ clap-test [TAB] <- gives me "foo bar --"
$ clap-test foo [TAB] <- gives me "--my-flag"
$ clap-test bar [TAB] <- gives me "--my-flag"
2024-05-17 15:17:44 +01:00
Pawel Zmarzly
be15bd5d96
fix(complete): Fix zsh.rs subcommand deduplication
...
Fixing the iteration over all_subcommands in zsh.rs. We deduplicate
values on (sc_name, bin_name) keys, but then only iterate on bin_name.
This doesn't cause problems now, since all bin names seem to be unique.
However, without fixing this, the next commit would have started
generating duplicated functions with same names.
For example, with an #[long = "foo", visible_alias = "bar"] subcommand,
we'll end up with 2 pairs: [("foo", "foo"), ("bar", "foo")]. Before this
commit, we would have ended up generating _my-app__foo_commands()
functions. These functions should have identical content, so it is not
an error, just an inefficiency that we can fix.
2024-05-17 15:16:43 +01:00
Ed Page
800d7cb8ad
chore: Update from template
2024-05-14 12:27:02 -05:00
sudotac
cd82f8cc8e
fix(complete): Avoid use of -v in bash completion
...
Because -v is not supported below bash 5.0.
2024-04-07 23:19:50 +09:00
Alexis (Poliorcetics) Bourget
e782775229
fix(complete): Handle newlines in command/arg descriptions
...
Found while trying to add Nushell completions to
[`jj`](https://github.com/martinvonz/jj ).
2024-02-16 16:17:22 -06:00
sudotac
1edffb8576
fix(complete): Prevent filenames splitting
...
Fix #5313
2024-02-02 23:31:03 +09:00
Ed Page
646134a9a9
Merge pull request #5240 from sudotac/improve-bash-completion-with-compopt
...
Improve bash completion with compopt
2024-01-22 09:44:11 -06:00
sudotac
13a79804c9
fix(complete): Suppress a useless space completion
2024-01-20 21:29:51 +09:00
sudotac
e25b1abddf
feat(complete): Add DirPath support in bash
2024-01-20 21:29:50 +09:00
sudotac
3a222def22
fix(complete): Fix path completion in bash
...
Fix #5239
2024-01-20 21:29:06 +09:00
Sebastian Holmin
ba378e635c
fix(complete): Use bin_name
for subcommands
...
Bash completions for subcommands used package
name, which broke completions when the `bin_name`
was different.
Update the `custom_bin_name` test to reflect the
correct behavior.
2024-01-19 10:27:36 +01:00
Ed Page
6fcba9821d
fix(complete): Don't provide help output for user
...
We shouldn't be injecting help when being flattened.
Unsure why this made tests fail inconsistentkly between CI and local
2024-01-15 12:51:45 -06:00
Henry Hsieh
2b48858ba8
fix: Skip nosort option below bash 4.4
2024-01-02 21:14:20 +08:00
Ed Page
76beca4d4d
docs(complete): Polish API reference for dynamic
2023-12-27 11:57:38 -06:00
Ed Page
3724b9e2e4
docs: Include more content on docs.rs
2023-12-27 11:30:42 -06:00
Ed Page
28425e484f
style(docs): Resolve warnings
2023-11-07 13:44:41 -06:00
Ed Page
dfebb54423
style: Make clippy happy
2023-10-12 08:32:59 -05:00
Ed Page
017c258be1
fix(complete): Include positionals in subcommands
...
Fixes #5139
2023-09-25 16:15:02 -05:00
jporwal05
34291a2b46
fix: (fish-completion) Help for value enum
...
Resolves #5101
- The completion of value enums now displays accurate help text
- This fix encloses help text in single quotes
- Any text after tab is taken as help text
- Comma in help text is not escaped
- This is because the the help text is now treated as literal
- No variable expansion or command substitution in help text
2023-09-07 17:54:28 +05:30
Roland Fredenhagen
5b10a9d83c
test(complete): Test help escaping
2023-08-04 01:20:50 +07:00
Roland Fredenhagen
bdefebf663
feat(complete): Show help in dynamic completions
2023-08-04 01:20:47 +07:00
Roland Fredenhagen
b613548b03
refactor(complete): Stop using generate utils in dynamic
2023-08-03 16:51:01 +07:00