funcs.go

 1package cli
 2
 3// BashCompleteFunc is an action to execute when the bash-completion flag is set
 4type BashCompleteFunc func(*Context)
 5
 6// BeforeFunc is an action to execute before any subcommands are run, but after
 7// the context is ready if a non-nil error is returned, no subcommands are run
 8type BeforeFunc func(*Context) error
 9
10// AfterFunc is an action to execute after any subcommands are run, but after the
11// subcommand has finished it is run even if Action() panics
12type AfterFunc func(*Context) error
13
14// ActionFunc is the action to execute when no subcommands are specified
15type ActionFunc func(*Context) error
16
17// CommandNotFoundFunc is executed if the proper command cannot be found
18type CommandNotFoundFunc func(*Context, string)
19
20// OnUsageErrorFunc is executed if an usage error occurs. This is useful for displaying
21// customized usage error messages.  This function is able to replace the
22// original error messages.  If this function is not set, the "Incorrect usage"
23// is displayed and the execution is interrupted.
24type OnUsageErrorFunc func(context *Context, err error, isSubcommand bool) error
25
26// FlagStringFunc is used by the help generation to display a flag, which is
27// expected to be a single line.
28type FlagStringFunc func(Flag) string