Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoRootCommand = errors.New("no root command provided")
ErrNoRootCommand is returned when no root command is provided.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { CobraProvider ErrorHandler Exit func(code int) // contains filtered or unexported fields }
App represents a command line application.
func (*App) Execute ¶
Execute will execute the application with the provided options and return error if any.
func (*App) ExecuteOrDie ¶
ExecuteOrDie will execute the application or perform os.Exit in case of error.
type CobraProvider ¶
CobraProvider is used to provide a Cobra command.
type ErrorHandler ¶ added in v1.2.0
ErrorHandler is a function that will be used to handle the errors. If true is returned, the default error handling will not be used. The Cobra's command passed to the error handler is the command that thrown the error.
type Option ¶
type Option func(*App)
Option is used to configure an App.
func WithCommand ¶ added in v1.1.0
WithCommand will allow one to change the cobra.Command.
func WithErrorHandler ¶ added in v1.2.0
func WithErrorHandler(fn ErrorHandler) Option
WithErrorHandler will allow changing the default error handler.
func WithInput ¶
WithInput creates an option witch sets os.Stdin. Deprecated: use WithCommand instead.
func WithOutput ¶
WithOutput creates an option witch sets os.Stdout and os.Stderr. Deprecated: use WithCommand instead.