a23fe06d68
* wrap emoji package in pkg/emoji * remove dependency on enescakir/emoji * remove dependency on gotest.tools * lint (whitespace)
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/aquasecurity/table"
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
|
|
"github.com/crowdsecurity/crowdsec/pkg/emoji"
|
|
)
|
|
|
|
func cmdConsoleStatusTable(out io.Writer, consoleCfg csconfig.ConsoleConfig) {
|
|
t := newTable(out)
|
|
t.SetRowLines(false)
|
|
|
|
t.SetHeaders("Option Name", "Activated", "Description")
|
|
t.SetHeaderAlignment(table.AlignLeft, table.AlignLeft, table.AlignLeft)
|
|
|
|
for _, option := range csconfig.CONSOLE_CONFIGS {
|
|
activated := emoji.CrossMark
|
|
|
|
switch option {
|
|
case csconfig.SEND_CUSTOM_SCENARIOS:
|
|
if *consoleCfg.ShareCustomScenarios {
|
|
activated = emoji.CheckMarkButton
|
|
}
|
|
case csconfig.SEND_MANUAL_SCENARIOS:
|
|
if *consoleCfg.ShareManualDecisions {
|
|
activated = emoji.CheckMarkButton
|
|
}
|
|
case csconfig.SEND_TAINTED_SCENARIOS:
|
|
if *consoleCfg.ShareTaintedScenarios {
|
|
activated = emoji.CheckMarkButton
|
|
}
|
|
case csconfig.SEND_CONTEXT:
|
|
if *consoleCfg.ShareContext {
|
|
activated = emoji.CheckMarkButton
|
|
}
|
|
case csconfig.CONSOLE_MANAGEMENT:
|
|
if *consoleCfg.ConsoleManagement {
|
|
activated = emoji.CheckMarkButton
|
|
}
|
|
}
|
|
|
|
t.AddRow(option, activated, csconfig.CONSOLE_CONFIGS_HELP[option])
|
|
}
|
|
|
|
t.Render()
|
|
}
|