cmdutils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSilent = WrapSilentError(stdErrors.New("SilentError"))

Functions

func Chdir

func Chdir() error

func DisableConfigCheck

func DisableConfigCheck(cmd *cobra.Command)

func ExecuteCommand

func ExecuteCommand(t *testing.T, cmd *cobra.Command, in io.Reader, args ...string) (string, error)

func GeneratedCorpusDir

func GeneratedCorpusDir(projectDir, fuzzTest string) string

func MarkFlagsRequired

func MarkFlagsRequired(cmd *cobra.Command, flags ...string)

func NeedsConfig

func NeedsConfig(cmd *cobra.Command) bool

func ValidateSeedCorpusDirs

func ValidateSeedCorpusDirs(seedCorpusDirs []string) ([]string, error)

ValidateSeedCorpusDirs checks if the seed dirs exist and can be accessed and ensures that the paths are absolute

func ViperMustBindPFlag

func ViperMustBindPFlag(key string, flag *pflag.Flag)

func WrapCouldBeSandboxError

func WrapCouldBeSandboxError(err error) error

WrapCouldBeSandboxError wraps an existing error into a CouldBeSandboxError to hint on disabling the sandbox when the error is handled.

func WrapExecError

func WrapExecError(err error, cmd *exec.Cmd) error

WrapExecError wraps an existing error into an ExecError to include information about the exec.Cmd which failed in the error message.

func WrapIncorrectUsageError

func WrapIncorrectUsageError(err error) error

WrapIncorrectUsageError wraps an existing error into a IncorrectUsageError to have the usage message printed when the error is handled.

func WrapSilentError

func WrapSilentError(err error) error

WrapSilentError wraps an existing error into a SilentError to avoid having the error message printed when the error is handled.

Types

type CouldBeSandboxError

type CouldBeSandboxError struct {
	// contains filtered or unexported fields
}

CouldBeSandboxError indicates that the error might have been caused by the sandbox restricting access. When a CouldBeSandboxError is handled, a message should be printed which suggests to disable the sandbox if its not needed.

func (CouldBeSandboxError) Error

func (e CouldBeSandboxError) Error() string

func (CouldBeSandboxError) Unwrap

func (e CouldBeSandboxError) Unwrap() error

type ExecError

type ExecError struct {
	// contains filtered or unexported fields
}

ExecError includes information about the exec.Cmd which failed in the error message.

func (*ExecError) Error

func (e *ExecError) Error() string

func (*ExecError) Format

func (e *ExecError) Format(s fmt.State, verb rune)

func (*ExecError) Unwrap

func (e *ExecError) Unwrap() error

type IncorrectUsageError

type IncorrectUsageError struct {
	// contains filtered or unexported fields
}

IncorrectUsageError indicates that the command wasn't used correctly, for example because required arguments are missing. When an IncorrectUsageError is handled, the usage message should be printed.

func (IncorrectUsageError) Error

func (e IncorrectUsageError) Error() string

func (IncorrectUsageError) Unwrap

func (e IncorrectUsageError) Unwrap() error

type SignalError

type SignalError struct {
	Signal syscall.Signal
}

func NewSignalError

func NewSignalError(signal syscall.Signal) *SignalError

func (SignalError) Error

func (e SignalError) Error() string

type SilentError

type SilentError struct {
	// contains filtered or unexported fields
}

SilentError indicates that the error message should not be printed when the error is handled.

func (SilentError) Error

func (e SilentError) Error() string

func (SilentError) Unwrap

func (e SilentError) Unwrap() error

Jump to

Keyboard shortcuts

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