Use func (c *Command) consistently (#530)

It makes the docs looks better. The idea was suggested by @SamWhited
This commit is contained in:
Eric Paris
2017-09-05 13:20:51 -04:00
committed by GitHub
parent 4de692c1eb
commit b787445794
2 changed files with 24 additions and 24 deletions

View File

@ -9,24 +9,24 @@ import (
)
// GenZshCompletionFile generates zsh completion file.
func (cmd *Command) GenZshCompletionFile(filename string) error {
func (c *Command) GenZshCompletionFile(filename string) error {
outFile, err := os.Create(filename)
if err != nil {
return err
}
defer outFile.Close()
return cmd.GenZshCompletion(outFile)
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