Skip to content
Myr

Reuse GenBashCompletion in GenBashCompletionFile

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Daniel Martí · committed by Daniel Martí · parent 463be14 · Browse files · 1 file+1 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−9 removed

  • other:+1 added−9 removed

1 file+1 added−9 removed

modified:bash_completions.go+1 added-9 removed
1package cobra23import (4 "bytes"4 "fmt"5 "io"6 "os"7 "sort"
380 unmodified lines
388 postscript(w, cmd.Name())389}390391func (cmd *Command) GenBashCompletionFile(filename string) error {393 out := new(bytes.Buffer)394395 cmd.GenBashCompletion(out)396392 outFile, err := os.Create(filename)393 if err != nil {394 return err395 }396 defer outFile.Close()397403 _, err = outFile.Write(out.Bytes())404 if err != nil {405 return err406 }398 cmd.GenBashCompletion(outFile)399 return nil400}401402// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag, if it exists.
31 unmodified lines