util

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2021 License: GPL-3.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultErrorExitCode = 1

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(err error)

CheckErr prints a user friendly error to STDERR and exits with a non-zero exit code. Unrecognized errors will be printed with an "error: " prefix.

This method is generic to the command in use and may be used by non-Devctl commands.

func DefaultSubCommandRun

func DefaultSubCommandRun(out io.Writer) func(c *cobra.Command, args []string)

DefaultSubCommandRun prints a command's help string to the specified output if no arguments (sub-commands) are provided, or a usage error otherwise.

func MultipleErrors

func MultipleErrors(prefix string, errs []error) string

MultipleErrors returns a newline delimited string containing the prefix and referenced errors in standard form.

func RequireNoArguments

func RequireNoArguments(c *cobra.Command, args []string)

RequireNoArguments exits with a usage error if extra arguments are provided.

func StandardErrorMessage

func StandardErrorMessage(err error) (msg string, ok bool)

func UsageErrorf

func UsageErrorf(cmd *cobra.Command, format string, args ...interface{}) error

Types

type Builder

type Builder struct {
}

type DefaultPluginHandler

type DefaultPluginHandler struct {
	ValidPrefixes []string
	Fs            afero.Fs
}

DefaultPluginHandler implements PluginHandler

func (*DefaultPluginHandler) Execute

func (d *DefaultPluginHandler) Execute(executablePath string, cmdArgs, environment []string) (err error)

func (*DefaultPluginHandler) Lookup

func (d *DefaultPluginHandler) Lookup(name string) (executablePath string, ok bool)

type PluginHandler

type PluginHandler interface {
	Lookup(name string) (executablePath string, ok bool)
	Execute(executablePath string, cmdArgs, environment []string) (err error)
}

func NewDefaultPluginHandler

func NewDefaultPluginHandler() PluginHandler

Jump to

Keyboard shortcuts

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