File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 44 "fmt"
55 "osctl/pkg/config"
66 "osctl/pkg/logging"
7+ "strings"
78
89 "github.com/spf13/cobra"
910)
@@ -60,6 +61,11 @@ func Execute(version string) error {
6061
6162 rootCmd .PersistentPreRunE = func (cmd * cobra.Command , args []string ) error {
6263 commandName := cmd .Name ()
64+ commandPath := cmd .CommandPath ()
65+ if commandName == "completion" || commandName == "help" ||
66+ commandPath == "osctl completion" || strings .HasPrefix (commandPath , "osctl completion" ) {
67+ return nil
68+ }
6369 if commandName == "osctl" {
6470 if action , _ := cmd .Flags ().GetString ("action" ); action != "" {
6571 return nil
Original file line number Diff line number Diff line change 6969)
7070
7171func LoadConfig (cmd * cobra.Command , commandName string ) error {
72+ if commandName == "completion" || commandName == "help" {
73+ return nil
74+ }
75+
7276 viper .Reset ()
7377 viper .SetConfigType ("yaml" )
7478
You can’t perform that action at this time.
0 commit comments