(f factory.Factory)
| 15 | ) |
| 16 | |
| 17 | func NewCmdSet(f factory.Factory) *cobra.Command { |
| 18 | cmd := &cobra.Command{ |
| 19 | Use: "set [key] [value]", |
| 20 | Short: "Set will write the value for given key to Octopus CLI config file", |
| 21 | Long: "Set will write the value for given key to Octopus CLI config file.", |
| 22 | RunE: func(_ *cobra.Command, args []string) error { |
| 23 | key := "" |
| 24 | value := "" |
| 25 | if len(args) > 0 { |
| 26 | key = args[0] |
| 27 | if len(args) > 1 { |
| 28 | value = args[1] |
| 29 | } |
| 30 | } |
| 31 | return setRun(f.IsPromptEnabled(), f.Ask, key, value) |
| 32 | |
| 33 | }, |
| 34 | } |
| 35 | return cmd |
| 36 | } |
| 37 | |
| 38 | func setRun(isPromptEnabled bool, ask question.Asker, key string, value string) error { |
| 39 | // have to make new viper so it only contains file value, no ENVs or Flags |
nothing calls this directly
no test coverage detected