options

package
v0.3.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: Apache-2.0 Imports: 9 Imported by: 2

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
	Name             string
	Version          string
	Platforms        []string // orders matter (same as args)
	Dependencies     []string
	Requirements     []string
	Tags             []string
	AnnotationSource 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

	// 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
	// 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.

func (*CommonOptions) IsVerbose

func (o *CommonOptions) IsVerbose() bool

IsVerbose used to check if the verbose flag is set or not.

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.

type RegistryOptions

type RegistryOptions struct {
	PlainHTTP bool
}

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

func (*RegistryOptions) AddFlags

func (r *RegistryOptions) 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