( globalCmd *cobra.Command, )
| 71 | } |
| 72 | |
| 73 | func setGlobalConfigForDelegatedCommands( |
| 74 | globalCmd *cobra.Command, |
| 75 | ) func(cmd *cobra.Command, args []string) error { |
| 76 | return func(cmd *cobra.Command, args []string) error { |
| 77 | globalPath, err := ensureGlobalConfig() |
| 78 | if err != nil { |
| 79 | return err |
| 80 | } |
| 81 | |
| 82 | for _, c := range globalCmd.Commands() { |
| 83 | if f := c.Flag("config"); f != nil && f.Value.Type() == "string" { |
| 84 | if err := f.Value.Set(globalPath); err != nil { |
| 85 | return errors.WithStack(err) |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | return nil |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | func ensureGlobalEnvEnabled(cmd *cobra.Command, args []string) error { |
| 94 | if cmd.Name() == "shellenv" { |
no test coverage detected