kiterunner icon indicating copy to clipboard operation
kiterunner copied to clipboard

Bash & Zsh completion (WIP)

Open Albonycal opened this issue 4 years ago • 3 comments

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 avatar Apr 12 '21 15:04 Albonycal

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 avatar Apr 12 '21 22:04 minight

Hmm.. Interesting.. ok

Albonycal avatar Apr 13 '21 09:04 Albonycal

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

minight avatar Apr 13 '21 22:04 minight