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

Method NewCommand

cmd/crowdsec-cli/clipapi/papi.go:31–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29}
30
31func (cli *cliPapi) NewCommand() *cobra.Command {
32 cmd := &cobra.Command{
33 Use: "papi [action]",
34 Short: "Manage interaction with Polling API (PAPI)",
35 DisableAutoGenTag: true,
36 Args: args.NoArgs,
37 RunE: func(cmd *cobra.Command, _ []string) error {
38 return cmd.Usage()
39 },
40 PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
41 cfg := cli.cfg()
42 if err := require.LAPI(cfg); err != nil {
43 return err
44 }
45 if err := require.CAPI(cfg); err != nil {
46 return err
47 }
48
49 return require.PAPI(cfg)
50 },
51 }
52
53 cmd.AddCommand(cli.newStatusCmd())
54 cmd.AddCommand(cli.newSyncCmd())
55
56 return cmd
57}
58
59func (cli *cliPapi) Status(ctx context.Context, out io.Writer, db *database.Client) error {
60 cfg := cli.cfg()

Callers

nothing calls this directly

Calls 7

newStatusCmdMethod · 0.95
newSyncCmdMethod · 0.95
LAPIFunction · 0.92
CAPIFunction · 0.92
PAPIFunction · 0.92
cfgMethod · 0.80
AddCommandMethod · 0.80

Tested by

no test coverage detected