Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completions for subcommand aliases #5243

Closed
2 tasks done
dfgordon opened this issue Dec 3, 2023 · 4 comments
Closed
2 tasks done

completions for subcommand aliases #5243

dfgordon opened this issue Dec 3, 2023 · 4 comments
Labels
A-completion Area: completion generator C-enhancement Category: Raise on the bar on expectations E-hard Call for participation: Experience needed to fix: Hard / a lot

Comments

@dfgordon
Copy link

dfgordon commented Dec 3, 2023

Please complete the following tasks

Clap Version

4.2.7

Describe your use case

A subcommand called catalog has aliases dir and ls. When clap_complete generates the zsh script it omits the aliases. As a result if a user tries ls they will not get the completions, and even worse, it tends to block the shell's natural path completions, making the tool less friendly instead of more.

Describe the solution you'd like

This appears easy to solve, you simply copy the block of the subcommand substituting the alias, such as

(mycommand)
...stuff
;;
(mycom)
...same stuff
;;

Alternatives, if applicable

No response

Additional Context

No response

@dfgordon dfgordon added the C-enhancement Category: Raise on the bar on expectations label Dec 3, 2023
@epage epage added E-hard Call for participation: Experience needed to fix: Hard / a lot A-completion Area: completion generator labels Dec 4, 2023
@dfgordon
Copy link
Author

dfgordon commented Dec 10, 2023

Without intervention zsh offers the aliases. With the intervention proposed above (tested) it still does so but also allows arguments to be completed. So far I didn't find any downside.

I have not tried with the other shells, except to note that bash is already handling it without any intervention.

Screenshot 2023-12-10 at 11 08 20 AM

@dfgordon
Copy link
Author

Minor note, tried all with clap and clap_complete 4.4.4, all results the same.

@nasso
Copy link

nasso commented Mar 21, 2024

isn't this a duplicate of #4265 ?

@epage
Copy link
Member

epage commented Mar 21, 2024

Thanks for catching that!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion Area: completion generator C-enhancement Category: Raise on the bar on expectations E-hard Call for participation: Experience needed to fix: Hard / a lot
Projects
None yet
Development

No branches or pull requests

3 participants