* add hub type "context" * cscli lapi: log.Fatal -> fmt.Errorf; lint * tests for context.yaml * load console context from hub * original & compiled context * deprecate "cscli lapi context delete" $ cscli lapi context delete Command "delete" is deprecated, please manually edit the context file. * cscli completion: add appsec-rules, appsec-configs, explain, hubtest
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"github.com/crowdsecurity/crowdsec/pkg/cwhub"
|
|
)
|
|
|
|
func NewContextCLI() *itemCLI {
|
|
return &itemCLI{
|
|
name: cwhub.CONTEXTS,
|
|
singular: "context",
|
|
oneOrMore: "context(s)",
|
|
help: cliHelp{
|
|
example: `cscli contexts list -a
|
|
cscli contexts install crowdsecurity/yyy crowdsecurity/zzz
|
|
cscli contexts inspect crowdsecurity/yyy crowdsecurity/zzz
|
|
cscli contexts upgrade crowdsecurity/yyy crowdsecurity/zzz
|
|
cscli contexts remove crowdsecurity/yyy crowdsecurity/zzz
|
|
`,
|
|
},
|
|
installHelp: cliHelp{
|
|
example: `cscli contexts install crowdsecurity/yyy crowdsecurity/zzz`,
|
|
},
|
|
removeHelp: cliHelp{
|
|
example: `cscli contexts remove crowdsecurity/yyy crowdsecurity/zzz`,
|
|
},
|
|
upgradeHelp: cliHelp{
|
|
example: `cscli contexts upgrade crowdsecurity/yyy crowdsecurity/zzz`,
|
|
},
|
|
inspectHelp: cliHelp{
|
|
example: `cscli contexts inspect crowdsecurity/yyy crowdsecurity/zzz`,
|
|
},
|
|
listHelp: cliHelp{
|
|
example: `cscli contexts list
|
|
cscli contexts list -a
|
|
cscli contexts list crowdsecurity/yyy crowdsecurity/zzz
|
|
|
|
List only enabled contexts unless "-a" or names are specified.`,
|
|
},
|
|
}
|
|
}
|