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

Provide bash, zsh and powershell completions (a breeze with cobra) #69

Open
panchoh opened this issue Oct 26, 2019 · 0 comments
Open

Provide bash, zsh and powershell completions (a breeze with cobra) #69

panchoh opened this issue Oct 26, 2019 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@panchoh
Copy link
Contributor

panchoh commented Oct 26, 2019

I just discovered this in cobra:

// GenBashCompletionFile generates bash completion file.
func (c *Command) GenBashCompletionFile(filename string) error {...}

There are equivalent functions for zsh and powershell.

I've tried and generated a bash-completion file, it was easy:

main.go:

...
    kapowCmd.GenBashCompletionFile("/tmp/kapow")
...

Then, I sourced the file from bash, and we have completion, yay!

@panchoh panchoh added the enhancement New feature or request label Oct 26, 2019
@panchoh panchoh added this to the 1.1.0 milestone Oct 26, 2019
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

No branches or pull requests

1 participant