()
| 303 | } |
| 304 | |
| 305 | func (cli *cliConsole) newDisableCmd() *cobra.Command { |
| 306 | var disableAll bool |
| 307 | |
| 308 | cmd := &cobra.Command{ |
| 309 | Use: "disable [option]", |
| 310 | Short: "Disable a console option", |
| 311 | Example: "sudo cscli console disable tainted", |
| 312 | Long: ` |
| 313 | Disable given information push to the central API.`, |
| 314 | ValidArgs: csconfig.CONSOLE_CONFIGS, |
| 315 | DisableAutoGenTag: true, |
| 316 | RunE: func(_ *cobra.Command, args []string) error { |
| 317 | if disableAll { |
| 318 | if err := cli.setConsoleOpts(csconfig.CONSOLE_CONFIGS, false); err != nil { |
| 319 | return err |
| 320 | } |
| 321 | |
| 322 | log.Infof("All features have been disabled") |
| 323 | } else { |
| 324 | if len(args) == 0 { |
| 325 | return errors.New("you must specify at least one feature to disable") |
| 326 | } |
| 327 | |
| 328 | if err := cli.setConsoleOpts(args, false); err != nil { |
| 329 | return err |
| 330 | } |
| 331 | |
| 332 | log.Infof("%v have been disabled", args) |
| 333 | } |
| 334 | |
| 335 | if msg := reload.UserMessage(); msg != "" { |
| 336 | log.Info(msg) |
| 337 | } |
| 338 | |
| 339 | return nil |
| 340 | }, |
| 341 | } |
| 342 | cmd.Flags().BoolVarP(&disableAll, "all", "a", false, "Disable all console options") |
| 343 | |
| 344 | return cmd |
| 345 | } |
| 346 | |
| 347 | func (cli *cliConsole) newStatusCmd() *cobra.Command { |
| 348 | cmd := &cobra.Command{ |
no test coverage detected