Use cmd's out fd instead of os'
This commit is contained in:
parent
c0bd4fd0e1
commit
37b2300907
1 changed files with 2 additions and 3 deletions
|
@ -2,7 +2,6 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -48,13 +47,13 @@ To configure your zsh shell to load completions for each session, add the above
|
||||||
}
|
}
|
||||||
|
|
||||||
func bashCompletionCmdF(cmd *cobra.Command, args []string) {
|
func bashCompletionCmdF(cmd *cobra.Command, args []string) {
|
||||||
if err := cmd.Root().GenBashCompletion(os.Stdout); err != nil {
|
if err := cmd.Root().GenBashCompletion(cmd.OutOrStdout()); err != nil {
|
||||||
ErrorAndExit(cmd, fmt.Errorf("unable to generate completions: %w", err))
|
ErrorAndExit(cmd, fmt.Errorf("unable to generate completions: %w", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func zshCompletionCmdF(cmd *cobra.Command, args []string) {
|
func zshCompletionCmdF(cmd *cobra.Command, args []string) {
|
||||||
if err := cmd.Root().GenZshCompletion(os.Stdout); err != nil {
|
if err := cmd.Root().GenZshCompletion(cmd.OutOrStdout()); err != nil {
|
||||||
ErrorAndExit(cmd, fmt.Errorf("unable to generate completions: %w", err))
|
ErrorAndExit(cmd, fmt.Errorf("unable to generate completions: %w", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue