Debian Codegraph @

funcs.go

raw symbols SCIP
1 package cli
2
3 import "context"
4
5 // ShellCompleteFunc is an action to execute when the shell completion flag is set
6 type ShellCompleteFunc func(context.Context, *Command)
7
8 // BeforeFunc is an action that executes prior to any subcommands being run once
9 // the context is ready. If a non-nil error is returned, no subcommands are
10 // run.
11 type BeforeFunc func(context.Context, *Command) (context.Context, error)
12
13 // AfterFunc is an action that executes after any subcommands are run and have
14 // finished. The AfterFunc is run even if Action() panics.
15 type AfterFunc func(context.Context, *Command) error
16
17 // ActionFunc is the action to execute when no subcommands are specified
18 type ActionFunc func(context.Context, *Command) error
19
20 // CommandNotFoundFunc is executed if the proper command cannot be found
21 type CommandNotFoundFunc func(context.Context, *Command, string)
22
23 // ConfigureShellCompletionCommand is a function to configure a shell completion command
24 type ConfigureShellCompletionCommand func(*Command)
25
26 // OnUsageErrorFunc is executed if a usage error occurs. This is useful for displaying
27 // customized usage error messages. This function is able to replace the
28 // original error messages. If this function is not set, the "Incorrect usage"
29 // is displayed and the execution is interrupted.
30 type OnUsageErrorFunc func(ctx context.Context, cmd *Command, err error, isSubcommand bool) error
31
32 // InvalidFlagAccessFunc is executed when an invalid flag is accessed from the context.
33 type InvalidFlagAccessFunc func(context.Context, *Command, string)
34
35 // ExitErrHandlerFunc is executed if provided in order to handle exitError values
36 // returned by Actions and Before/After functions.
37 type ExitErrHandlerFunc func(context.Context, *Command, error)
38
39 // FlagStringFunc is used by the help generation to display a flag, which is
40 // expected to be a single line.
41 type FlagStringFunc func(Flag) string
42
43 // FlagNamePrefixFunc is used by the default FlagStringFunc to create prefix
44 // text for a flag's full name.
45 type FlagNamePrefixFunc func(fullName []string, placeholder string) string
46
47 // FlagEnvHintFunc is used by the default FlagStringFunc to annotate flag help
48 // with the environment variable details.
49 type FlagEnvHintFunc func(envVars []string, str string) string
50
51 // FlagFileHintFunc is used by the default FlagStringFunc to annotate flag help
52 // with the file path details.
53 type FlagFileHintFunc func(filePath, str string) string