options

package
v0.10.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Overview

Package options implements the generic logic to manage the common options shared by all the falcoctl commands.

Index

Constants

View Source
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"
)

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
	AutoFloatingTags bool
	AnnotationSource string
}

Artifact specific options. Commands that need these options may embed this struct in their options.

func (*Artifact) AddFlags added in v0.6.0

func (art *Artifact) AddFlags(cmd *cobra.Command) error

AddFlags registers the artifacts flags.

func (*Artifact) OSArch added in v0.6.0

func (art *Artifact) OSArch(index int) (os, arch string)

OSArch returns the OS and the ARCH of the platform at index-th position.

func (*Artifact) Validate added in v0.6.0

func (art *Artifact) Validate() error

Validate validates the options passed by the user.

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 NewOptions

func NewOptions() *Common

NewOptions returns a new Common struct.

func (*Common) AddFlags added in v0.6.0

func (o *Common) AddFlags(flags *pflag.FlagSet)

AddFlags registers the common flags.

func (*Common) Initialize added in v0.6.0

func (o *Common) Initialize(cfgs ...Configs)

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

func WithIndexCache(c *cache.Cache) Configs

WithIndexCache sets the index cache.

func WithWriter

func WithWriter(writer io.Writer) Configs

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.

func (*Directory) AddFlags added in v0.7.0

func (o *Directory) AddFlags(cmd *cobra.Command)

AddFlags registers the directories flags.

type Driver added in v0.7.0

type Driver struct {
	Type     drivertype.DriverType
	Name     string
	Repos    []string
	Version  string
	HostRoot string
	Distro   driverdistro.Distro
	Kr       kernelrelease.KernelRelease
}

Driver defines options that are common while interacting with driver commands.

func (*Driver) ToDriverConfig added in v0.7.0

func (d *Driver) ToDriverConfig() *config.Driver

ToDriverConfig maps a Driver options to Driver config struct.

func (*Driver) Validate added in v0.7.0

func (d *Driver) Validate() error

Validate runs all validators steps for Driver options.

type DriverTypes added in v0.7.0

type DriverTypes struct {
	*enum.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 Registry added in v0.6.0

type Registry struct {
	PlainHTTP bool
}

Registry defines options that are common while interacting with a remote registry.

func (*Registry) AddFlags added in v0.6.0

func (r *Registry) AddFlags(cmd *cobra.Command)

AddFlags registers the registry flags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL