Skip to content

Commit e66094e

Browse files
committed
Set cli stdout so completion work correctly
1 parent 290236b commit e66094e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/cmd/skupper/root/root.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package root
22

33
import (
4+
"os"
5+
"slices"
6+
47
"github.com/skupperproject/skupper/internal/cmd/skupper/common"
58
"github.com/skupperproject/skupper/internal/cmd/skupper/connector"
69
"github.com/skupperproject/skupper/internal/cmd/skupper/debug"
@@ -38,6 +41,11 @@ func NewSkupperRootCommand() *cobra.Command {
3841

3942
rootCmd.SetHelpCommand(&cobra.Command{Hidden: true})
4043

44+
completionCommands := []string{"completion", cobra.ShellCompRequestCmd, cobra.ShellCompNoDescRequestCmd}
45+
if len(os.Args) <= 2 || !slices.Contains(completionCommands, os.Args[1]) {
46+
rootCmd.SetOut(os.Stderr)
47+
}
48+
4149
return rootCmd
4250
}
4351

0 commit comments

Comments
 (0)