cmd

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GitCommit string

GitCommit value set by a linker flag

View Source
var Version string

Version value set by a linker flag

Functions

func CommandWithoutConfig added in v0.12.0

func CommandWithoutConfig(cmdLine []string) bool

CommandWithoutConfig return true if current command does not need a config file. Called from within a cobra initializer function. Unfortunately there is no way of getting the current command from an cobra initializer so we scan the command line again.

func Execute

func Execute()

Execute runs the subcommand. Execute adds all child commands to the root command and sets flags appropriately. In case of errors Execute prints the returned error to stderr and ends the process with a non-zero exit code.

Types

type Error added in v0.8.0

type Error struct {
	Command *cobra.Command
	What    string
	Err     error
}

Error is returned when something goes wrong in a command or sub-command.

func NewError added in v0.8.0

func NewError(cmd *cobra.Command, what string, err error) *Error

NewError constructs a new error.

func (*Error) Error added in v0.8.0

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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