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

add example code of generating Zsh completion #1005

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions zsh_completions.md
Expand Up @@ -4,6 +4,14 @@ Cobra supports native Zsh completion generated from the root `cobra.Command`.
The generated completion script should be put somewhere in your `$fpath` named
`_<YOUR COMMAND>`.

```go
// Output to given io.Writer
rootCmd.GenZshCompletion(os.Stdout)

// Output to given file
rootCmd.GenZshCompletionFile("/path/to/fpath/_your_command")
```

### What's Supported

* Completion for all non-hidden subcommands using their `.Short` description.
Expand Down