Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCobraSubcommand ¶
func NewCobraSubcommand(subcmd Subcommand, hooks ...InitHook) (*cobra.Command, error)
func NewCobraSubcommandOrDie ¶
func NewCobraSubcommandOrDie(subcmd Subcommand, hooks ...InitHook) *cobra.Command
func RunSubcommand ¶
func RunSubcommand(cmd Subcommand, args []string) error
Types ¶
type RequiresPostRun ¶
type RequiresPostRun interface {
// PostRun runs after command's Run().
PostRun(args []string) error
}
RequiresValidation is a subcommand that requires post run
type RequiresPreRun ¶
type RequiresPreRun interface {
// PreRun runs before command's Run().
// It can be used to verify that the command can be run
PreRun(args []string) error
}
RequiresValidation is a subcommand that requires pre run
type Subcommand ¶
type Subcommand interface {
// Name returns the subcommand's name
Name() string
// BindFlags binds the subcommand's flags to the CLI. This allows each subcommand to define its own
// command line flags.
BindFlags(fs *pflag.FlagSet)
// Run runs the subcommand.
Run(args []string) error
}
Subcommand is an interface that defines the common base for subcommands returned by plugins
Click to show internal directories.
Click to hide internal directories.