2022-10-07 09:05:35 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/aquasecurity/table"
|
|
|
|
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
|
2024-02-23 15:05:01 +00:00
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/emoji"
|
2022-10-07 09:05:35 +00:00
|
|
|
)
|
|
|
|
|
2024-02-12 10:45:58 +00:00
|
|
|
func cmdConsoleStatusTable(out io.Writer, consoleCfg csconfig.ConsoleConfig) {
|
2022-10-07 09:05:35 +00:00
|
|
|
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 {
|
2024-02-23 15:05:01 +00:00
|
|
|
activated := emoji.CrossMark
|
2024-02-12 10:45:58 +00:00
|
|
|
|
2022-10-07 09:05:35 +00:00
|
|
|
switch option {
|
|
|
|
case csconfig.SEND_CUSTOM_SCENARIOS:
|
2024-02-12 10:45:58 +00:00
|
|
|
if *consoleCfg.ShareCustomScenarios {
|
2024-02-23 15:05:01 +00:00
|
|
|
activated = emoji.CheckMarkButton
|
2022-10-07 09:05:35 +00:00
|
|
|
}
|
|
|
|
case csconfig.SEND_MANUAL_SCENARIOS:
|
2024-02-12 10:45:58 +00:00
|
|
|
if *consoleCfg.ShareManualDecisions {
|
2024-02-23 15:05:01 +00:00
|
|
|
activated = emoji.CheckMarkButton
|
2022-10-07 09:05:35 +00:00
|
|
|
}
|
|
|
|
case csconfig.SEND_TAINTED_SCENARIOS:
|
2024-02-12 10:45:58 +00:00
|
|
|
if *consoleCfg.ShareTaintedScenarios {
|
2024-02-23 15:05:01 +00:00
|
|
|
activated = emoji.CheckMarkButton
|
2022-10-07 09:05:35 +00:00
|
|
|
}
|
2023-01-04 15:50:02 +00:00
|
|
|
case csconfig.SEND_CONTEXT:
|
2024-02-12 10:45:58 +00:00
|
|
|
if *consoleCfg.ShareContext {
|
2024-02-23 15:05:01 +00:00
|
|
|
activated = emoji.CheckMarkButton
|
2023-01-04 15:50:02 +00:00
|
|
|
}
|
2023-01-31 13:47:44 +00:00
|
|
|
case csconfig.CONSOLE_MANAGEMENT:
|
2024-02-12 10:45:58 +00:00
|
|
|
if *consoleCfg.ConsoleManagement {
|
2024-02-23 15:05:01 +00:00
|
|
|
activated = emoji.CheckMarkButton
|
2023-01-31 13:47:44 +00:00
|
|
|
}
|
2022-10-07 09:05:35 +00:00
|
|
|
}
|
2024-02-12 10:45:58 +00:00
|
|
|
|
2024-01-19 14:49:00 +00:00
|
|
|
t.AddRow(option, activated, csconfig.CONSOLE_CONFIGS_HELP[option])
|
2022-10-07 09:05:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
t.Render()
|
|
|
|
}
|