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

Bash & Zsh completion (WIP) #15

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

Bash & Zsh completion (WIP) #15

wants to merge 1 commit into from

Conversation

Albonycal
Copy link
Contributor

@Albonycal Albonycal commented Apr 12, 2021

This adds auto completion for zsh & bash...
How should we implement this?
Like We can add just a couple lines to the Readme for bash or zsh completions, But how will this be implemented on pre-compiled binaries? Include the completion files with the archive?
Thank you :)

@Albonycal Albonycal changed the title Bash & Zsh completion Bash & Zsh completion (WIP) Apr 12, 2021
@minight
Copy link
Contributor

minight commented Apr 12, 2021

I would suggest leveraging the existing cobra framework for using completions. https://github.com/spf13/cobra/blob/master/shell_completions.md

This would then allow for baking the completion into the binary itself so people can just run kr completion zsh >> ~/.zshrc

@minight minight added the enhancement New feature or request label Apr 12, 2021
@Albonycal
Copy link
Contributor Author

Hmm.. Interesting.. ok

@minight
Copy link
Contributor

minight commented Apr 13, 2021

You should be able to generate the completions by using cobra along the lines of

cd cmd/kiterunner
cobra add completions

I think. I haven't had a chance to try yet, but this might have the desired effect of generating autocompletion for all commands.

Additional work would be annotating specific flags with better autocompletion hints, like the output flag https://github.com/spf13/cobra/blob/master/shell_completions.md#specify-dynamic-flag-completion

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

Successfully merging this pull request may close these issues.

2 participants