()
| 40 | } |
| 41 | |
| 42 | func (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 | |
| 69 | func (cli *cliConsole) enroll(ctx context.Context, key string, name string, overwrite bool, tags []string, opts []string, autoEnroll bool) error { |
| 70 | cfg := cli.cfg() |
nothing calls this directly
no test coverage detected