Documentation
¶
Index ¶
- func Error(msg string)
- func Fatal(msg string)
- func GetBool(args Args, name string) bool
- func GetInt(args Args, name string) (int, error)
- func GetString(args Args, name string) string
- func Info(msg string)
- func IsJSON(args Args) bool
- func IsTTY() bool
- func Run(app *App) error
- func RunApp(app *App) error
- func Success(msg string)
- type App
- func Action(app *App, handler func(Args)) *App
- func AddFlag(app *App, name string, description string, defaultValue string) *App
- func Arg(app *App, name string, description string) *App
- func Description(app *App, desc string) *App
- func GlobalFlag(app *App, name string, desc string, defaultValue string) *App
- func New(name string) *App
- func WithCommands(app *App, cmds ...*SubcommandDef) *App
- type ArgDef
- type Args
- type FlagDef
- type SubcommandDef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
Name string
Description string
Args []ArgDef
Flags []FlagDef
GlobalFlags []FlagDef
Subcommands []*SubcommandDef
ActionFunc func(Args)
}
func Description ¶
func WithCommands ¶ added in v0.6.1
func WithCommands(app *App, cmds ...*SubcommandDef) *App
type SubcommandDef ¶
type SubcommandDef struct {
Name string
Description string
Args []ArgDef
Flags []FlagDef
ActionFunc func(Args)
}
func NewCommand ¶ added in v0.6.1
func NewCommand(name string, desc string) *SubcommandDef
func (*SubcommandDef) Action ¶ added in v0.6.1
func (cmd *SubcommandDef) Action(handler func(Args)) *SubcommandDef
func (*SubcommandDef) Arg ¶ added in v0.6.1
func (cmd *SubcommandDef) Arg(name string, description string) *SubcommandDef
func (*SubcommandDef) Flag ¶ added in v0.6.1
func (cmd *SubcommandDef) Flag(name string, desc string, defaultValue string) *SubcommandDef
Click to show internal directories.
Click to hide internal directories.