Commit graph

564 commits

Author SHA1 Message Date
Ed Page
84cfd92843
Merge pull request #5667 from a-kenji/fix-typo
Fix typo in dynamic completion doc comment
2024-08-12 08:38:57 -05:00
Ed Page
cddbb5689f fix(complete): Correct version check 2024-08-12 08:29:11 -05:00
Ed Page
63740539d3 style: Order fn attributes 2024-08-12 08:26:42 -05:00
Ed Page
f75251f5ae fix(complete)!: Rename shells to command 2024-08-12 08:12:21 -05:00
a-kenji
ef8dc8fe11 fix: Typo in dynamic completion doc comment 2024-08-12 14:12:17 +02:00
Ed Page
158e7161aa fix(complete)!: Remove unused CommandCompleter trait method 2024-08-10 21:27:02 -05:00
Ed Page
b94fce3242 fix(complete)!: Put CompleteCommand behind unstable-command
Avoid the cost of the deps when not needed.
2024-08-10 20:41:01 -05:00
Ed Page
2b2b2be610 refactor(complete): Isolate all CommandCompleter knowledge 2024-08-10 20:34:20 -05:00
Ed Page
d064946c60 refactor(complete): Consolidate CommandCompleter's 2024-08-10 20:28:22 -05:00
Ed Page
d69e0dc777 fix(complete)!: Rename ShwllCompleter to CommandCompleter
This opens space for several completion strategies
2024-08-10 20:24:53 -05:00
Ed Page
775688e7d1 fix(complete)!: Dont assume powershell on Windows
We have issues open for other Windows shells, so this seems like a bad
idea.
2024-08-10 20:07:41 -05:00
Ed Page
0d7cb9eeec fix(complete)!: Error, rather than default, on unknown shell 2024-08-10 19:54:49 -05:00
Ed Page
64bf287e68 fix(complete)!: Switch --shell to a positional
This matches how I've seen it done elsewhere
and removes extra boilerplate
2024-08-10 19:38:59 -05:00
Ed Page
c9df58bcf7 fix(complete)!: Remove --register
Our focus is on encouraging people to generate this on shell load so its
more "auto-updating" as programs are updated.
Having a flag for saving to a file is counter to that goal.
2024-08-10 19:33:49 -05:00
Ed Page
34c86159a9 fix(complete): Ensure bash does not sort, we do 2024-08-10 18:31:30 -05:00
Ed Page
10607966bd refactor(complete): Organize around completion UI 2024-08-10 15:49:52 -05:00
Ed Page
8cb0e7fdaf test(complete): Normalize snapshot format 2024-08-10 18:37:01 -05:00
Ed Page
e3188215ca chore: Release 2024-08-09 19:30:46 -05:00
Ed Page
79bbdb78c8 docs: Update changelog 2024-08-09 19:30:37 -05:00
Ed Page
c8cff2f123 fix(complete): Ensure new-enough clap is used 2024-08-09 19:26:19 -05:00
Ed Page
918cfed43d
Merge pull request #5610 from Mixu78/powershell_hyphens
Add missing option hyphens to generated PowerShell completion scripts
2024-08-09 19:22:30 -05:00
Ed Page
219a1915e9 fix(complete): Improve help output 2024-08-09 16:17:44 -05:00
Ed Page
734cac730c feat(complete): Make '--register' optional 2024-08-09 16:16:15 -05:00
Ed Page
fa4ccec694 feat(complete): Make '--shell' optional 2024-08-09 16:10:37 -05:00
Ed Page
e65e46356d docs(complete): Have dynamic Shell match static Shell 2024-08-09 15:59:59 -05:00
Ed Page
7fa26589df feat(complete): Infer shell for dynamic completions 2024-08-09 15:44:32 -05:00
shannmu
f9a87bf1bf feat(clap_complete): Add support for Powershell 2024-08-09 15:48:20 -05:00
Ed Page
ad48d3b2a9 docs(complete): Clarify CompletionCandidate 2024-08-09 15:21:06 -05:00
Ed Page
fb243a8801 doc(complete): Show easier access to CompleteCommand 2024-08-09 15:14:33 -05:00
Ed Page
5f322e481a docs(complete): Tell users how to customize 2024-08-09 15:11:55 -05:00
Ed Page
b4625620fd fix(complete): Make it easier to access clap integration 2024-08-09 15:09:40 -05:00
Ed Page
c2765a4e85 docs(complete): Expand dynamic docs 2024-08-09 14:56:58 -05:00
Ed Page
f374830df4 feat(complete): Add CompleteArgs::complete 2024-08-09 14:31:57 -05:00
Ed Page
f807acef6d refactor(complete): Move impl next to type 2024-08-09 14:30:47 -05:00
Ed Page
38816ddb33 fix(complete)!: Clarify Completer is a ShellCompleter 2024-08-09 14:03:02 -05:00
Ed Page
16366d21f1 fix(complete)!: Move Completer into shells
It only exists for shell-adaptation, so it feels like it better belongs
there.
2024-08-09 14:00:42 -05:00
Ed Page
261116d4b4 fix(complete)!: Rename CustomCompleter::completions to candidates
After thinking on this, I feel like it gives a better sense that the
user doesn't get a say in the completion but they give us the options
and we take care of it.
2024-08-09 13:56:47 -05:00
Ed Page
a4775efca1 refactor(complete): Split up completion code 2024-08-09 13:20:37 -05:00
Ed Page
18c560e52f style(complete): Make clippy happy 2024-08-09 13:00:22 -05:00
shanmu
2b3fc25361 refactor(complete): Add add_prefix to CompletionCandidate 2024-08-09 12:58:45 -05:00
Ed Page
d222ae4cb6 chore: Release 2024-08-08 11:09:07 -05:00
Ed Page
a8abcb40c5 docs: Update changelog 2024-08-08 11:08:55 -05:00
shanmu
7fd7b3e40b feat(clap_complete): Support to complete custom value of argument 2024-08-08 23:47:17 +08:00
shanmu
bbb2e6fdde test: Add test case for completing custom value of argument 2024-08-08 20:56:51 +08:00
shanmu
999071c46d fix: Change visible to hidden 2024-08-08 20:56:31 +08:00
Ed Page
4db9fce3d7 feat(complete): Reexport ValueHint for transition to ArgExt 2024-08-02 10:24:43 -05:00
Mixu78
10fd5fe8e3
fix(clap_complete): Add missing option hyphens to the listItemText parameter in PowerShell completions 2024-07-31 21:30:55 +03:00
Ed Page
d18615dfc0 chore: Release 2024-07-31 12:20:00 -05:00
Ed Page
7d0c7bceaf docs: Update changelog 2024-07-31 12:19:41 -05:00
shannmu
f0bd47506f feat(clap_complete): Support multi-values of positional argument with num_arg(N) 2024-07-31 20:27:37 +08:00
shanmu
3f2466b2f6 test(clap_complete): Add test case for multi-values of positional argument with num_args(N) 2024-07-31 20:25:57 +08:00
shannmu
75a45e5aa0 feat(clap_complete): Support multiple values after flags in native completions 2024-07-30 18:33:43 +08:00
shannmu
5d8c84b83e test(clap_complete): Add test case for multi-values comlpetion after flags 2024-07-30 18:32:29 +08:00
Ed Page
9c6ef3e057 refactor: Resolve deprecations 2024-07-26 14:24:08 -05:00
Ed Page
82912c3a51 style: Make clippy happy 2024-07-26 14:24:08 -05:00
Ed Page
349ed304cf chore: Release 2024-07-25 13:08:28 -05:00
Ed Page
68ed9ff02d docs: Update changelog 2024-07-25 13:08:20 -05:00
Ed Page
afecaa4f9a
Merge pull request #5576 from shannmu/option_value_new
feat(clap_complete): Support `-fbar` and `-f=bar` in native completions
2024-07-25 13:07:24 -05:00
Ed Page
4a00677024 chore: Release 2024-07-25 08:39:13 -05:00
shannmu
36c849b5bb refactor(clap_complete): Reuse code about shortflag parsing 2024-07-25 14:57:27 +08:00
shanmu
fc479ba625 feat(clap_complete): Add support for -fbar and -f=bar completion 2024-07-25 14:49:19 +08:00
shanmu
48a23f5c94 test(clap_complete): Add test cases for -fbar and -f=bar completion 2024-07-25 14:49:06 +08:00
Ed Page
5efa52ad45 chore: Release 2024-07-23 10:36:14 -05:00
Ed Page
1857e47e2d docs: Update changelog 2024-07-23 10:35:20 -05:00
shanmu
f7383f7d6d feat(clap_complete): Add support --flag bar and -f bar completion 2024-07-23 18:18:30 +08:00
shannmu
2f53bb3f90 test(clap_complete): Add test cases for --flag bar and -f bar completion 2024-07-23 17:47:05 +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
4395c31cc5 test(clap_complete): Add test case for 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
shannmu
db1fbc29b9 test(clap_complete): Add test case for 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
shannmu
903b73bd1c test(clap_complete): Add test cases for 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
shanmu
c41d41cbdc test(clap_complete): Add test case for visible subcommand aliases 2024-07-16 16:26:02 +08:00
Ed Page
44189f3388 chore: Release 2024-07-10 20:34:37 -05:00
Ed Page
f5e7b7a16a docs: Update changelog 2024-07-10 20:34:29 -05: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
1c5a625ad0 fix: Fix wrong cfg(linux) 2024-07-05 15:35:01 -05:00
Lzu Tao
2d2d1f4987 chore: Bump completest 2024-07-05 15:35:01 -05:00
Lzu Tao
7c00ad2e3e test(comlete): Show all fish completions 2024-07-05 15:34:42 -05:00
Ed Page
3689a4c867 test(complete): Fix snapshots 2024-07-05 15:02:08 -05:00
Ed Page
469d847d35 chore: Release 2024-06-28 12:44:19 -04:00
Ed Page
e323b912a6 docs: Update changelog 2024-06-28 12:43:51 -04: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
Ed Page
5cc44bb91e
Merge pull request #5548 from tesuji/fish-escape-tab
style: fish: escaping tab as \t for more readibility
2024-06-26 12:27:13 -05:00
Ed Page
0724b7ba2b chore: Remove tarpaulin support 2024-06-26 09:03:34 -04:00
Lzu Tao
b16f987ad7 style: Escaping tab as \t for more readability for fish 2024-06-25 08:42:49 +07:00
Ed Page
9c1153d6b4 chore: Release 2024-06-19 16:03:52 -05:00
Ed Page
b3effeae10 style: Make clippy happy 2024-06-13 12:45:33 -05:00
Ed Page
2f645d3e81 chore: Release 2024-06-07 16:13:55 -05:00
Ed Page
6e1e0368f9 docs: Update changelog 2024-06-07 16:12:56 -05:00
Ben Rogers
8e3c273b61 fix(zsh): Separate options from _arguments options 2024-06-07 15:20:04 -04:00
Ed Page
ff3713d770 chore: Release 2024-06-06 16:41:05 -05:00
Ed Page
3572ab8fa3 chore(complete): Require latest clap 2024-06-06 16:37:19 -05:00
Ed Page
d87dee6d48
Merge pull request #5476 from pzmarzly/issue-4265
feat(complete): generate completions for visible aliases
2024-06-06 16:33:01 -05:00
Ed Page
f087c39884 chore: Release 2024-06-06 15:14:24 -05:00
Ed Page
5e3386bb40 docs: Link to repo, not webpage inside repo 2024-06-04 15:36:17 -05:00
Ed Page
75e2199415 chore: Upgrade snapbox 2024-05-24 10:13:50 -05: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
renovate[bot]
24651fcfef
chore(deps): update compatible (dev) (#5477)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-01 01:04:57 +00:00
Ed Page
3092aa4a0d chore: Release 2024-04-09 12:08:43 -05:00
Ed Page
dc333288ec docs: Update changelog 2024-04-09 12:08:33 -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
renovate[bot]
9d14f394ba
chore(deps): update compatible (dev) (#5438)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-01 00:30:25 +00:00
Pi-Cla
3b35dba160 docs: Add mention of nushell to clap_complete README 2024-03-22 11:43:50 -06:00
renovate[bot]
a2aa644368
chore(deps): update compatible (dev) (#5381)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-01 00:16:52 +00:00
Ed Page
0c01b5558d chore: Release 2024-02-16 16:33:14 -06:00
Ed Page
08e0b5bde4 docs: Update changelog 2024-02-16 16:32:57 -06: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
Ed Page
fba7c8597b test(complete): Show newline issue 2024-02-16 16:16:36 -06:00
Ed Page
5f9cecb6bd chore: Update snapbox/trycmd 2024-02-14 16:44:57 -06:00
Ed Page
a751c5fe65 chore: Release 2024-02-08 10:34:06 -06:00
Ed Page
9ec6c942b8 chore: Release 2024-02-08 10:33:13 -06:00
Ed Page
0735119775 docs: Update changelog 2024-02-08 10:32:13 -06:00
Ed Page
ea77b98da3 test(complete): Make it order independent 2024-02-08 06:19:06 -06:00
Ed Page
708afa33ef chore: Release 2024-02-02 10:12:09 -06:00
Ed Page
ec74349838 docs: Update changelog 2024-02-02 10:12:02 -06:00
sudotac
1edffb8576 fix(complete): Prevent filenames splitting
Fix #5313
2024-02-02 23:31:03 +09:00
sudotac
fe16f24ed8 test(complete): Verify filename splitting 2024-02-02 23:31:03 +09:00
renovate[bot]
4788918e01
chore(deps): update compatible (dev) (#5333)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-01 01:26:55 +00:00
Ed Page
bd9583059b chore: Release 2024-01-22 09:46:21 -06:00
Ed Page
35a96b0824 docs: Update changelog 2024-01-22 09:46:07 -06: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
sudotac
62a5ace9f1 test(complete): Verify some variants of ValueHint 2024-01-20 21:28:52 +09:00
Ed Page
6a2b3bf4fa chore: Release 2024-01-19 10:47:00 -06:00
Ed Page
069c7a6245 docs: Update changelog 2024-01-19 10:46:46 -06: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