()
| 261 | } |
| 262 | |
| 263 | func (cli *cliConsole) newEnableCmd() *cobra.Command { |
| 264 | var enableAll bool |
| 265 | |
| 266 | cmd := &cobra.Command{ |
| 267 | Use: "enable [option]...", |
| 268 | Short: "Enable a console option", |
| 269 | Example: "sudo cscli console enable tainted", |
| 270 | Long: ` |
| 271 | Enable given information push to the central API. Allows to empower the console`, |
| 272 | ValidArgs: csconfig.CONSOLE_CONFIGS, |
| 273 | DisableAutoGenTag: true, |
| 274 | RunE: func(_ *cobra.Command, args []string) error { |
| 275 | if enableAll { |
| 276 | if err := cli.setConsoleOpts(csconfig.CONSOLE_CONFIGS, true); err != nil { |
| 277 | return err |
| 278 | } |
| 279 | |
| 280 | log.Infof("All features have been enabled successfully") |
| 281 | } else { |
| 282 | if len(args) == 0 { |
| 283 | return errors.New("you must specify at least one feature to enable") |
| 284 | } |
| 285 | |
| 286 | if err := cli.setConsoleOpts(args, true); err != nil { |
| 287 | return err |
| 288 | } |
| 289 | |
| 290 | log.Infof("%v have been enabled", args) |
| 291 | } |
| 292 | |
| 293 | if reload.UserMessage() != "" { |
| 294 | log.Info(reload.UserMessage()) |
| 295 | } |
| 296 | |
| 297 | return nil |
| 298 | }, |
| 299 | } |
| 300 | cmd.Flags().BoolVarP(&enableAll, "all", "a", false, "Enable all console options") |
| 301 | |
| 302 | return cmd |
| 303 | } |
| 304 | |
| 305 | func (cli *cliConsole) newDisableCmd() *cobra.Command { |
| 306 | var disableAll bool |
no test coverage detected