Documentation
¶
Index ¶
- Variables
- func BindCobra(name string, root any) (*cobra.Command, error)
- func BindUrfave(name string, root any) (*cli.Command, error)
- func MustBindCobra(name string, root any) *cobra.Command
- func MustBindUrfave(name string, root any) *cli.Command
- type CobraCommand
- type Command
- type Defaulter
- type ExistingFilePath
- type Group
- type Helper
- type Map
- type Parser
- type ShortHelper
- type SimpleCommand
- type UrfaveCommand
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidType will be returned when a type that doesn't implement the correct interfaces is passed to a bidning function ErrInvalidType = errors.New("invlaid type") // ErrNotACommand will be returned when a binding target doesn't implement one of the command interfaces. ErrNotACommand = errors.New("not a command") )
Functions ¶
func BindUrfave ¶ added in v0.3.0
BindUrfave binds a structure to a *cli.Command (and sub-commands)
func MustBindCobra ¶ added in v0.2.0
MustBindCobra will panic if BindCobra returns an error
Types ¶
type CobraCommand ¶ added in v0.2.0
CobraCommand is the a comand that implements the cobra.Command.Run interface. This is useful when you need lower level access to things like global options or the raw cli args.
type Command ¶
type Command interface {
Run([]string)
}
Command is a runnable command that doesn't have sub commands
type Defaulter ¶
type Defaulter interface {
Default()
}
Defaulter can set up the default arguments of a command
type ExistingFilePath ¶ added in v0.4.0
type ExistingFilePath string
func (*ExistingFilePath) Open ¶ added in v0.4.0
func (e *ExistingFilePath) Open() *os.File
func (ExistingFilePath) Validate ¶ added in v0.4.0
func (e ExistingFilePath) Validate() error
type Group ¶
type Group interface {
SubCommands() Map
}
Group is a set of subcommands or sub groups.
type Helper ¶
type Helper interface {
Help() string
}
Helper returns usage information for a command or group.
type ShortHelper ¶ added in v0.2.0
type ShortHelper interface {
ShortHelp() string
}
ShortHelper implements a less verbose help.
type SimpleCommand ¶ added in v0.2.0
type SimpleCommand interface {
Run()
}
SimpleCommand is a command that doesn't care about the raw args
type UrfaveCommand ¶ added in v0.3.0
type UrfaveCommand interface {
Run(ctx interface{}, cmd interface{}) error // Using interface{} to avoid importing urfave/cli
}
UrfaveCommand is a command that implements the urfave/cli v3 ActionFunc interface. This is useful when you need access to the cli.Command for urfave/cli specific features. Note: This interface is defined here but only used when binding to urfave/cli.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
deeply_nested
command
|
|
|
ls
command
|
|
|
urfave
command
|
|
|
tests
|
|
|
embedded/pkg2
command
|