[#1041] autocomplete: fetch output stream from provided command
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
c01acba3ce
commit
c35cdb3684
1 changed files with 4 additions and 5 deletions
|
@ -2,7 +2,6 @@ package autocomplete
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -48,13 +47,13 @@ func Command(name string) *cobra.Command {
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
switch args[0] {
|
||||
case "bash":
|
||||
_ = cmd.Root().GenBashCompletion(os.Stdout)
|
||||
_ = cmd.Root().GenBashCompletion(cmd.OutOrStdout())
|
||||
case "zsh":
|
||||
_ = cmd.Root().GenZshCompletion(os.Stdout)
|
||||
_ = cmd.Root().GenZshCompletion(cmd.OutOrStdout())
|
||||
case "fish":
|
||||
_ = cmd.Root().GenFishCompletion(os.Stdout, true)
|
||||
_ = cmd.Root().GenFishCompletion(cmd.OutOrStdout(), true)
|
||||
case "powershell":
|
||||
_ = cmd.Root().GenPowerShellCompletion(os.Stdout)
|
||||
_ = cmd.Root().GenPowerShellCompletion(cmd.OutOrStdout())
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue