You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.2 KiB

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