options

package
v0.0.0-...-30fe120 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactOptions

type ArtifactOptions struct {
	ArtifactType oci.ArtifactType
	Platforms    []string // orders matter (same as args)
	Dependencies []string
	Tags         []string
}

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

func (*ArtifactOptions) AddFlags

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

AddFlags registers the artifacts flags.

func (*ArtifactOptions) OSArch

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

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

func (*ArtifactOptions) Validate

func (art *ArtifactOptions) Validate() error

Validate validates the options passed by the user.

type CommonOptions

type CommonOptions struct {
	// Printer used by all commands to output messages.
	Printer *output.Printer
	// contains filtered or unexported fields
}

CommonOptions provides the common flags, options, and printers for all the commands. All the fields provided by the CommonOptions will be initialized before the commands are executed through the Initialize func.

func NewOptions

func NewOptions() *CommonOptions

NewOptions returns a new CommonOptions struct.

func (*CommonOptions) AddFlags

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

AddFlags registers the common flags.

func (*CommonOptions) Initialize

func (o *CommonOptions) 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 *CommonOptions)

Configs type of the configs accepted by the Initialize function.

func WithPrinterScope

func WithPrinterScope(scope string) Configs

WithPrinterScope sets the scope for the printer.

func WithWriter

func WithWriter(writer io.Writer) Configs

WithWriter sets the writer for the printer.

Jump to

Keyboard shortcuts

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