diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-29 12:46:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-29 12:46:30 -0700 |
commit | b84736e9b6401df0c6eeab9950bef09458a6aefd (patch) | |
tree | d9175208de3236db75a33879750a57b3000ba096 /vendor/github.com/spf13/cobra/zsh_completions.go | |
parent | 8b9dbb86133ff0fd6002a391268383d1593918ca (diff) | |
download | chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.tar.gz chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.tar.bz2 chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.zip |
Updating server dependancies. (#7538)
Diffstat (limited to 'vendor/github.com/spf13/cobra/zsh_completions.go')
-rw-r--r-- | vendor/github.com/spf13/cobra/zsh_completions.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/vendor/github.com/spf13/cobra/zsh_completions.go b/vendor/github.com/spf13/cobra/zsh_completions.go index b350aeeca..889c22e27 100644 --- a/vendor/github.com/spf13/cobra/zsh_completions.go +++ b/vendor/github.com/spf13/cobra/zsh_completions.go @@ -4,17 +4,29 @@ import ( "bytes" "fmt" "io" + "os" "strings" ) +// GenZshCompletionFile generates zsh completion file. +func (c *Command) GenZshCompletionFile(filename string) error { + outFile, err := os.Create(filename) + if err != nil { + return err + } + defer outFile.Close() + + return c.GenZshCompletion(outFile) +} + // GenZshCompletion generates a zsh completion file and writes to the passed writer. -func (cmd *Command) GenZshCompletion(w io.Writer) error { +func (c *Command) GenZshCompletion(w io.Writer) error { buf := new(bytes.Buffer) - writeHeader(buf, cmd) - maxDepth := maxDepth(cmd) + writeHeader(buf, c) + maxDepth := maxDepth(c) writeLevelMapping(buf, maxDepth) - writeLevelCases(buf, maxDepth, cmd) + writeLevelCases(buf, maxDepth, c) _, err := buf.WriteTo(w) return err |