MCPcopy
hub / github.com/crowdsecurity/crowdsec / newDisableCmd

Method newDisableCmd

cmd/crowdsec-cli/cliconsole/console.go:305–345  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

303}
304
305func (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: `
313Disable 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
347func (cli *cliConsole) newStatusCmd() *cobra.Command {
348 cmd := &cobra.Command{

Callers 1

NewCommandMethod · 0.95

Calls 3

setConsoleOptsMethod · 0.95
UserMessageFunction · 0.92
InfoMethod · 0.45

Tested by

no test coverage detected