Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is set at build time via ldflags; defaults to "dev".
Functions ¶
func Execute ¶
func Execute() int
Execute runs the root command and returns the appropriate exit code. It maps errors to exit codes per SPEC §19.
func ExecuteAndGetExitCode ¶
ExecuteAndGetExitCode runs the root command with the given args and returns the output and the mapped exit code.
func ExecuteWithArgs ¶
ExecuteWithArgs is used for testing: it sets custom args on the root command and captures all output. Returns the output string and the error.
func ExecuteWithArgsAndInput ¶
ExecuteWithArgsAndInput is used for testing commands that read from stdin.
func PrintError ¶
func PrintError(err error)
PrintError prints an error message to stderr, respecting the quiet flag.
Types ¶
type GlobalOpts ¶
type GlobalOpts struct {
Output string
Limit int
All bool
Marker string
Profile string
Verbose bool
Quiet bool
}
GlobalOpts holds the values of all global persistent flags.
var Opts GlobalOpts
Opts is the package-level GlobalOpts populated by PersistentPreRun.