Documentation ¶
Overview ¶
Package options implements the generic logic to manage the common options shared by all the falcoctl commands.
Index ¶
Constants ¶
const ( // FlagRulesFilesDir is the name of the flag to specify the directory path of rules files. FlagRulesFilesDir = "rulesfiles-dir" // FlagPluginsFilesDir is the name of the flag to specify the directory path of plugins. FlagPluginsFilesDir = "plugins-dir" // FlagAssetsFilesDir is the name of the flag to specify the directory path of assets. FlagAssetsFilesDir = "assets-dir" )
const ( // LogFormatColor formatting option for logs. LogFormatColor = "color" // LogFormatText formatting option for logs. LogFormatText = "text" // LogFormatJSON formatting otion for logs. LogFormatJSON = "json" )
const ( // LogLevelInfo level option for logs. LogLevelInfo = "info" // LogLevelWarn level opiton for logs. LogLevelWarn = "warn" // LogLevelDebug level option for logs. LogLevelDebug = "debug" // LogLevelTrace level option for logs. LogLevelTrace = "trace" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Artifact ¶ added in v0.6.0
type Artifact struct { ArtifactType oci.ArtifactType Name string Version string Platforms []string // orders matter (same as args) Dependencies []string Requirements []string Tags []string AnnotationSource string }
Artifact specific options. Commands that need these options may embed this struct in their options.
type Common ¶ added in v0.6.0
type Common struct { // Printer used by all commands to output messages. Printer *output.Printer // Config file. It must not be possible to be reinitialized by subcommands, // using the Initialize function. It will be attached as global flags. ConfigFile string // IndexCache caches the entries for the configured indexes. IndexCache *cache.Cache // contains filtered or unexported fields }
Common provides the common flags, options, and printers for all the commands. All the fields provided by the Common will be initialized before the commands are executed through the Initialize func.
func (*Common) Initialize ¶ added in v0.6.0
Initialize initializes the options based on the configs. Subsequent calls will overwrite the previous configurations based on the new configs passed to the functions.
type Configs ¶
type Configs func(options *Common)
Configs type of the configs accepted by the Initialize function.
func WithIndexCache ¶
WithIndexCache sets the index cache.
func WithWriter ¶
WithWriter sets the writer for the printer.
type Directory ¶ added in v0.7.0
type Directory struct { // RulesfilesDir path where rule are installed RulesfilesDir string // PluginsDir path where plugins are installed PluginsDir string // AssetsDire path where assets are installed AssetsDir string }
Directory options for install directories for artifacts.
type Driver ¶ added in v0.7.0
type Driver struct { Type drivertype.DriverType Name string Repos []string Version string HostRoot string }
Driver defines options that are common while interacting with driver commands.
func (*Driver) ToDriverConfig ¶ added in v0.7.0
ToDriverConfig maps a Driver options to Driver config struct.
type DriverTypes ¶ added in v0.7.0
type DriverTypes struct {
*Enum
}
DriverTypes data structure for driver types.
func NewDriverTypes ¶ added in v0.7.0
func NewDriverTypes() *DriverTypes
NewDriverTypes returns a new Enum configured for the driver types.
type Enum ¶ added in v0.7.0
type Enum struct {
// contains filtered or unexported fields
}
Enum implements the flag interface. It can be used as a base for new flags that can have a limited set of values.
func NewEnum ¶ added in v0.7.0
NewEnum returns an enum struct. The firs argument is a set of values allowed for the flag. The second argument is the default value of the flag.
type LogFormat ¶ added in v0.7.0
type LogFormat struct {
*Enum
}
LogFormat data structure for log-format flag.
func NewLogFormat ¶ added in v0.7.0
func NewLogFormat() *LogFormat
NewLogFormat returns a new Enum configured for the log formats flag.
func (*LogFormat) ToPtermFormatter ¶ added in v0.7.0
func (lg *LogFormat) ToPtermFormatter() pterm.LogFormatter
ToPtermFormatter converts the current formatter to pterm.LogFormatter.
type LogLevel ¶ added in v0.7.0
type LogLevel struct {
*Enum
}
LogLevel data structure for log-level flag.
func NewLogLevel ¶ added in v0.7.0
func NewLogLevel() *LogLevel
NewLogLevel returns a new Enum configured for the log level flag.
func (*LogLevel) ToPtermLogLevel ¶ added in v0.7.0
ToPtermLogLevel converts the current log level to pterm.LogLevel.