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

Autocomplete #36

Open
EduardoRodriguesF opened this issue Jan 25, 2024 · 9 comments
Open

Autocomplete #36

EduardoRodriguesF opened this issue Jan 25, 2024 · 9 comments
Assignees

Comments

@EduardoRodriguesF
Copy link
Owner

No description provided.

@GabrielBrandao1618
Copy link
Contributor

Do you think it would be a good idea to implement this by adding a command that outputs the entire completion script, just like Github CLI does?

@EduardoRodriguesF
Copy link
Owner Author

It's a good backup option, but I think installation script could do it by default.

We'd have to investigate how other installation methods deal with it. Cargo probably will ignore it (manpages still don't work with it), and I'd have to study about Homebrew's case.

But yes! a autocomplete command would be great too. We just have to study how to implement it and - if possible - find a way to automate it, since we already have a bunch of derives that could be used to dynamically generate such file.

@GabrielBrandao1618
Copy link
Contributor

But yes! a autocomplete command would be great too. We just have to study how to implement it and - if possible - find a way to automate it, since we already have a bunch of derives that could be used to dynamically generate such file.

Yeah, I asked this question because apparently this is the easiest way to implement this feature since there's already a crate that generates a completion script from a Clap cli, so it would be pretty easy.

Apparently you can do it in compile time as well, but I didn't find a good and practical way to implement this without using some nasty workarounds that even the docs suggest.

@EduardoRodriguesF
Copy link
Owner Author

Sounds great. Do you have any reference for the docs suggestions so I can take a look?

I might take some time this week to work on Quartz, but if you want to take on any of the issues feel free to tell me and I'll assign it to you so we don't work on the same issue separately.

@GabrielBrandao1618
Copy link
Contributor

This is the crate I was talking about: https://docs.rs/clap_complete/latest/clap_complete/

Oh! And I would love to work on this feature and also on #51

@EduardoRodriguesF
Copy link
Owner Author

Apparently some tools already place autocompletions in a specific path to make usage smoother. Might be an alternative as well. Apparently asdf but I haven't configured to have their completions...

Other tools like Git doesn't seem to need any extra steps to function properly.

@GabrielBrandao1618
Copy link
Contributor

Apparently some tools already place autocompletions in a specific path to make usage smoother. Might be an alternative as well. Apparently asdf but I haven't configured to have their completions...

I think oh-my-zsh stores all completion scripts in the same directory, but as far as I know, it won't automatically work by just leaving the file there

Other tools like Git doesn't seem to need any extra steps to function properly.

Really? I had to install a plugin in oh-my-zsh in order to have git completions, and as far as I know, the plugin sources the completion script under the hood anyways.

So I think we would have to implement plugins to every tool in order to have this. I might be wrong though, since I didn't find any source explaining in more details about this

@EduardoRodriguesF
Copy link
Owner Author

Yeah, let's try to develop ZSH's completions first and go from there. We can experiment later and update the thread as we learn. We'd have freedom to do so on installation script, and I can search if Homebrew also allows any kind of completions specs too.

@EduardoRodriguesF
Copy link
Owner Author

PR #54 is going great, but one thing I'd like to implement before we close this issue is completion for environments and handles as well. This one probably requires a more dense implementation, so we can do it in a new PR later. Just pointing it out so we don't forget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants