MCPcopy Index your code
hub / github.com/crowdsecurity/crowdsec / NewCommand

Method NewCommand

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

Source from the content-addressed store, hash-verified

40}
41
42func (cli *cliConsole) NewCommand() *cobra.Command {
43 cmd := &cobra.Command{
44 Use: "console [action]",
45 Short: "Manage interaction with Crowdsec console (https://app.crowdsec.net)",
46 DisableAutoGenTag: true,
47 PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
48 cfg := cli.cfg()
49 if err := require.LAPI(cfg); err != nil {
50 return err
51 }
52
53 if err := require.CAPI(cfg); err != nil {
54 return err
55 }
56
57 return require.CAPIRegistered(cfg)
58 },
59 }
60
61 cmd.AddCommand(cli.newEnrollCmd())
62 cmd.AddCommand(cli.newEnableCmd())
63 cmd.AddCommand(cli.newDisableCmd())
64 cmd.AddCommand(cli.newStatusCmd())
65
66 return cmd
67}
68
69func (cli *cliConsole) enroll(ctx context.Context, key string, name string, overwrite bool, tags []string, opts []string, autoEnroll bool) error {
70 cfg := cli.cfg()

Callers

nothing calls this directly

Calls 9

newEnrollCmdMethod · 0.95
newEnableCmdMethod · 0.95
newDisableCmdMethod · 0.95
newStatusCmdMethod · 0.95
LAPIFunction · 0.92
CAPIFunction · 0.92
CAPIRegisteredFunction · 0.92
cfgMethod · 0.80
AddCommandMethod · 0.80

Tested by

no test coverage detected