Documentation ¶
Overview ¶
Package cli provides a easy way to organize a cli program. For advance usage, check https://pkg.go.dev/github.com/urfave/cli/v2. Check the example in ./example.
Index ¶
- type Application
- type Command
- type CommandHandler
- type Context
- type Flag
- type FlagBool
- type FlagDuration
- type FlagFloat64
- type FlagFloat64Slice
- type FlagGeneric
- type FlagInt
- type FlagInt64
- type FlagInt64Slice
- type FlagIntSlice
- type FlagPath
- type FlagString
- type FlagStringSlice
- type FlagTimestamp
- type FlagUint
- type FlagUint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { cli.App SetupFunc CommandHandler }
Apppplication is the main structure of a cli application.
var App Application
App is the default application.
func (*Application) Action ¶
func (a *Application) Action(f CommandHandler)
Actions sets a handler running when no subcommands giving.
func (*Application) After ¶
func (a *Application) After(f CommandHandler)
After hooks a handler to execute after any subcommands are run, but after the subcommand has finished. It is run even if Action() panics.
func (*Application) Before ¶
func (a *Application) Before(f CommandHandler)
Before hooks a handler to execute before any sub-subcommands are run, but after the context is ready. If a non-nil error is returned, no sub-subcommands are run.
func (*Application) Command ¶
func (a *Application) Command(name, usage string, f CommandHandler) *Command
Command adds a sub command to the application.
func (*Application) Setup ¶ added in v1.1.4
func (a *Application) Setup(f CommandHandler)
Setup hooks a handler to execute before any sub-subcommands are run, but after the context is ready. Help subcommand won't run this hook. If a non-nil error is returned, no sub-subcommands are run.
type Command ¶
type Command struct {
*cli.Command
}
func (*Command) Action ¶
func (c *Command) Action(f CommandHandler)
func (*Command) After ¶
func (c *Command) After(f CommandHandler)
func (*Command) Before ¶
func (c *Command) Before(f CommandHandler)
type CommandHandler ¶
CommandHandler is a function to handle something.
type FlagDuration ¶
type FlagDuration = cli.DurationFlag
type FlagFloat64 ¶
type FlagFloat64 = cli.Float64Flag
type FlagFloat64Slice ¶
type FlagFloat64Slice = cli.Float64SliceFlag
type FlagGeneric ¶
type FlagGeneric = cli.GenericFlag
type FlagInt64Slice ¶
type FlagInt64Slice = cli.Int64SliceFlag
type FlagIntSlice ¶
type FlagIntSlice = cli.IntSliceFlag
type FlagString ¶
type FlagString = cli.StringFlag
type FlagStringSlice ¶
type FlagStringSlice = cli.StringSliceFlag
type FlagTimestamp ¶
type FlagTimestamp = cli.TimestampFlag
type FlagUint64 ¶
type FlagUint64 = cli.Uint64Flag