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

Method NewCommand

cmd/crowdsec-cli/clilapi/lapi.go:22–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20}
21
22func (cli *cliLapi) NewCommand() *cobra.Command {
23 cmd := &cobra.Command{
24 Use: "lapi [action]",
25 Short: "Manage interaction with Local API (LAPI)",
26 DisableAutoGenTag: true,
27 Args: args.NoArgs,
28 RunE: func(cmd *cobra.Command, _ []string) error {
29 return cmd.Usage()
30 },
31 PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
32 if err := cli.cfg().LoadAPIClient(); err != nil {
33 return fmt.Errorf("loading api client: %w", err)
34 }
35
36 return nil
37 },
38 }
39
40 cmd.AddCommand(cli.newRegisterCmd())
41 cmd.AddCommand(cli.newStatusCmd())
42 cmd.AddCommand(cli.newContextCmd())
43
44 return cmd
45}

Callers

nothing calls this directly

Calls 6

newRegisterCmdMethod · 0.95
newStatusCmdMethod · 0.95
newContextCmdMethod · 0.95
LoadAPIClientMethod · 0.80
cfgMethod · 0.80
AddCommandMethod · 0.80

Tested by

no test coverage detected