common

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TfmtText = "text"
	TfmtJson = "json"
	TfmtYaml = "yaml"
)

Variables

View Source
var (
	ErrTooManyArguments         = errors.New("too many arguments")
	ErrNotEnoughArguments       = errors.New("not enough arguments")
	ErrIpOrAliasExpected        = fmt.Errorf("IP or alias expected %w", ErrNotEnoughArguments)
	ErrEntryAlreadyExists       = errors.New("entry already exists")
	ErrTooManyEntries           = errors.New("too many entries found")
	ErrWrongArgumentValue       = errors.New("wrong argument value")
	ErrBlockNotFound            = errors.New("block not found")
	ErrAliasNotFound            = errors.New("alias not found")
	ErrNotSupportedOutputFormat = errors.New("not supported output format")
)

Functions

func FileSystem

func FileSystem(ctx context.Context) afero.Fs

Returns filesystem override if any

func RunCliCommand

func RunCliCommand(cliCmd CliCommand, cmd *cobra.Command, args []string)

func WithCustomFilesystem

func WithCustomFilesystem(ctx context.Context, fs afero.Fs) context.Context

Overrides filesystem used by commands

Types

type CliCommand

type CliCommand interface {
	Complete(cmd *cobra.Command, args []string) error
	Validate() error
	Execute() error
}

type GlobalOptions

type GlobalOptions struct {
	OutputFormat string
}

type OutputFormat

type OutputFormat int
const (
	FmtText OutputFormat = iota
	FmtJson OutputFormat = iota
	FmtYaml OutputFormat = iota
	FmtNext OutputFormat = iota
)

Jump to

Keyboard shortcuts

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