| 1 |
package cli |
| 2 |
|
| 3 |
// BashCompleteFunc is an action to execute when the shell completion flag is set |
| 4 |
type 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 |
| 8 |
type 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 |
| 12 |
type AfterFunc func(*Context) error |
| 13 |
|
| 14 |
// ActionFunc is the action to execute when no subcommands are specified |
| 15 |
type ActionFunc func(*Context) error |
| 16 |
|
| 17 |
// CommandNotFoundFunc is executed if the proper command cannot be found |
| 18 |
type CommandNotFoundFunc func(*Context, string) |
| 19 |
|
| 20 |
// OnUsageErrorFunc is executed if a 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. |
| 24 |
type OnUsageErrorFunc func(cCtx *Context, err error, isSubcommand bool) error |
| 25 |
|
| 26 |
// InvalidFlagAccessFunc is executed when an invalid flag is accessed from the context. |
| 27 |
type InvalidFlagAccessFunc func(*Context, string) |
| 28 |
|
| 29 |
// ExitErrHandlerFunc is executed if provided in order to handle exitError values |
| 30 |
// returned by Actions and Before/After functions. |
| 31 |
type ExitErrHandlerFunc func(cCtx *Context, err error) |
| 32 |
|
| 33 |
// FlagStringFunc is used by the help generation to display a flag, which is |
| 34 |
// expected to be a single line. |
| 35 |
type FlagStringFunc func(Flag) string |
| 36 |
|
| 37 |
// FlagNamePrefixFunc is used by the default FlagStringFunc to create prefix |
| 38 |
// text for a flag's full name. |
| 39 |
type FlagNamePrefixFunc func(fullName []string, placeholder string) string |
| 40 |
|
| 41 |
// FlagEnvHintFunc is used by the default FlagStringFunc to annotate flag help |
| 42 |
// with the environment variable details. |
| 43 |
type FlagEnvHintFunc func(envVars []string, str string) string |
| 44 |
|
| 45 |
// FlagFileHintFunc is used by the default FlagStringFunc to annotate flag help |
| 46 |
// with the file path details. |
| 47 |
type FlagFileHintFunc func(filePath, str string) string |