cmdutil

package
v0.0.0-...-f23cdb6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GenericErrorWrap wraps an error along with a message
	// The message is intended to be specific to a certain operation the user is trying to perform while the error is more generic
	GenericErrorWrap = func(msg string, err error) error {
		return fmt.Errorf("%s: %w", msg, err)
	}
	// ErrUnexpectedResponseStatus is used for generic response statuses that are unexpected, but not considered errors
	ErrUnexpectedResponseStatus = func(want, got int) error {
		return fmt.Errorf("unexpected response status - want %d, got %d", want, got)
	}
	// ErrExecutedOnAppliance signals when the program is executed within a appliance
	ErrExecutedOnAppliance = errors.New("This should not be executed on an appliance")
	// ErrExecutionCanceledByUser signals user-initiated cancellation
	ErrExecutionCanceledByUser = errors.New("Cancelled by user")
	// ErrCommandTimeout is used instead of the default 'Context exceeded deadline' when command times out
	ErrCommandTimeout = errors.New("Command timed out")
	// ErrMissingTTY is used when no TTY is available
	ErrMissingTTY = errors.New("No TTY present")
	// ErrNetworkError is used when a command encounters multiple timeouts on a request, which we will presume is a network error
	ErrNetworkError = errors.New("Failed to communicate with SDP Collective. Bad connection")
	// ErrSSL is used when a certificate is not provided or is invalid
	ErrSSL = errors.New("Trust the certificate or import a PEM file using 'sdpctl configure --pem=<path/to/pem>'")
	// ErrNothingToPrepare is used when there are no appliances to prepare for upgrade
	ErrNothingToPrepare = errors.New("No appliances to prepare for upgrade. All appliances may have been filtered or are already prepared. See the log for more details")
	// ErrDailyVersionCheck is used when version check has already been done recently
	ErrDailyVersionCheck = errors.New("version check already done today")
	// ErrVersionCheckDisabled is used when version check has been disabled
	ErrVersionCheckDisabled = errors.New("version check disabled")
	// ErrUnsupportedOperation is used when the user tries to do an operation that is unsupported by the Appliance, likely due to version
	ErrUnsupportedOperation = errors.New("Operation not supported on your appliance version")
)
View Source
var ErrExitAuth = errors.New("no authentication")
View Source
var HideIncludeExcludeFlags = func(command *cobra.Command, strings []string) {

	command.Flags().MarkHidden("exclude")
	command.Flags().MarkHidden("include")

	command.Parent().HelpFunc()(command, strings)
}

Functions

func CurrentProfile

func CurrentProfile() string

func GetCaller

func GetCaller() string

func GetConfigPath

func GetConfigPath() string

func GetLogPath

func GetLogPath() string

func IsCygwinTerminal

func IsCygwinTerminal(f *os.File) bool

func IsTTY

func IsTTY(out io.Writer) bool

func IsTTYRead

func IsTTYRead(out io.ReadCloser) bool

Types

type ExitCode

type ExitCode int
const (
	ExitOK     ExitCode = 0
	ExitError  ExitCode = 1
	ExitCancel ExitCode = 2
	ExitAuth   ExitCode = 4
)

func ExecuteCommand

func ExecuteCommand(cmd *cobra.Command) ExitCode

Jump to

Keyboard shortcuts

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