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

feat(clap-complete): implemented Generator for Clink autocompletions #5379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wabo225
Copy link

@wabo225 wabo225 commented Feb 28, 2024

Basic implementation for #3159

After seeing that Clink wasn't included among the other Shells, I figured it wouldn't be too much trouble to add the basics of autocomplete. I'm privy to the complications brought up in #3166. Any semblance of safety seems to fly out of the window for this kind of cross language metaprogramming

Anyways I very nearly mirrored the implementation that the elvish generator uses, targeting the Lua script requirements for Clink to autocomplete.

I'll say I'm relatively new to open source contributions, so let me know if you have any feedback, or if I should dig a little deeper into this issue!

Context Quote from Issue #3159:

Describe your use case

While cmd.exe is not extensible out-of-the-box, there's a very popular framework known as Clink (which is used by the Cmder package) that adds Readline support along with history, completions, autosuggestions and highlighting. A set of handwritten completions are already available here https://github.com/vladimir-kotikov/clink-completions as an example.

As Clink does provide an official and extremely flexible API for writing completions, I feel this is something that Rust CLI programs can utilize through clap.

Describe the solution you'd like

I'm not very familiar with Rust itself, but similar to clap_generate/src/generators/shells/elvish.rs, we can have a clap_generate/src/generators/shells/cmd.rs source file too.

@epage
Copy link
Member

epage commented Feb 28, 2024

#3159 suggests this should start as a clap_complete_clink until we decide to officially promote this to being in clap_complete.

Would there also be a way for this to be integrated into completest so we can get end-to-end completion testing? This isn't a blocker but a nice to have.

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

Successfully merging this pull request may close these issues.

None yet

2 participants