Documentation ¶
Index ¶
- Variables
- func WithFlagBool(name string, value bool, usage string)
- func WithFlagDuration(name string, value time.Duration, usage string)
- func WithFlagFloat64(name string, value float64, usage string)
- func WithFlagInt(name string, value int, usage string)
- func WithFlagInt64(name string, value int64, usage string)
- func WithFlagIntSlice(name string, value []int, usage string)
- func WithFlagString(name string, value string, usage string)
- func WithFlagStringSlice(name string, value []string, usage string)
- func WithFlagUint(name string, value uint, usage string)
- func WithFlagUint64(name string, value uint64, usage string)
- type Action
- type App
- func (app *App) Action() Action
- func (app *App) AddCommand(command *command.Command) *App
- func (app *App) Commands() []*command.Command
- func (app *App) Flags() []cli.Flag
- func (app *App) Kernel() *cli.App
- func (app *App) OnAfterAction(action Action) *App
- func (app *App) OnBeforeAction(action Action) *App
- func (app *App) Run() error
- func (app *App) WithAction(action Action) *App
- func (app *App) WithCommandNotFoundHandler(handler CommandNotFoundHandler) *App
- func (app *App) WithExitErrHandler(handler ExitErrHandlerFunc) *App
- func (app *App) WithFlagBool(name string, value bool, usage string, required bool, hidden ...bool) *App
- func (app *App) WithFlagDuration(name string, value time.Duration, usage string, required bool, hidden ...bool) *App
- func (app *App) WithFlagFloat64(name string, value float64, usage string, required bool, hidden ...bool) *App
- func (app *App) WithFlagInt(name string, value int, usage string, required bool, hidden ...bool) *App
- func (app *App) WithFlagInt64(name string, value int64, usage string, required bool, hidden ...bool) *App
- func (app *App) WithFlagIntSlice(name string, value []int, usage string, required bool, hidden ...bool) *App
- func (app *App) WithFlagString(name string, value string, usage string, required bool, hidden ...bool) *App
- func (app *App) WithFlagStringSlice(name string, value []string, usage string, required bool, hidden ...bool) *App
- func (app *App) WithFlagUint(name string, value uint, usage string, required bool, hidden ...bool) *App
- func (app *App) WithFlagUint64(name string, value uint64, usage string, required bool, hidden ...bool) *App
- func (app *App) WithUsageErrorHandler(handler UsageErrorHandler) *App
- type Author
- type CommandNotFoundHandler
- type Config
- type ExitErrHandlerFunc
- type Option
- func WithArgsUsage(argsUsage string) Option
- func WithAuthor(author string) Option
- func WithAuthors(authors []Author) Option
- func WithCompiled(compiled time.Time) Option
- func WithCopyright(copyright string) Option
- func WithCustomAppHelpTemplate(customAppHelpTemplate string) Option
- func WithDescription(description string) Option
- func WithEmail(email string) Option
- func WithEnableBashCompletion(enableBashCompletion bool) Option
- func WithErrWriter(errWriter io.Writer) Option
- func WithHelpName(helpName string) Option
- func WithHideHelp(hideHelp bool) Option
- func WithHideVersion(hideVersion bool) Option
- func WithName(name string) Option
- func WithUsage(usage string) Option
- func WithUsageText(usageText string) Option
- func WithUseShortOptionHandling(useShortOptionHandling bool) Option
- func WithVersion(version string) Option
- func WithWriter(writer io.Writer) Option
- type UsageErrorHandler
- type Value
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NilAction = func(v Value) error { return nil } HelpAction = func(v Value) error { args := v.Args() if args.Present() { return cli.ShowCommandHelp(v.Kernel(), args.First()) } _ = cli.ShowAppHelp(v.Kernel()) return nil } )
Functions ¶
func WithFlagBool ¶
func WithFlagFloat64 ¶
func WithFlagInt ¶
func WithFlagInt64 ¶
func WithFlagIntSlice ¶
func WithFlagString ¶
func WithFlagStringSlice ¶
WithFlagStringSlice example: main.ext -names Bob -names Tom -names Lisa
func WithFlagUint ¶
func WithFlagUint64 ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func NewAppWithConfig ¶
func (*App) OnAfterAction ¶
func (*App) OnBeforeAction ¶
func (*App) WithAction ¶
func (*App) WithCommandNotFoundHandler ¶
func (app *App) WithCommandNotFoundHandler(handler CommandNotFoundHandler) *App
WithCommandNotFoundHandler Execute this function if the proper command cannot be found
func (*App) WithExitErrHandler ¶
func (app *App) WithExitErrHandler(handler ExitErrHandlerFunc) *App
WithExitErrHandler Execute this function to handle ExitErrors.
func (*App) WithFlagBool ¶
func (*App) WithFlagDuration ¶
func (*App) WithFlagFloat64 ¶
func (*App) WithFlagInt ¶
func (*App) WithFlagInt64 ¶
func (*App) WithFlagIntSlice ¶
func (app *App) WithFlagIntSlice(name string, value []int, usage string, required bool, hidden ...bool) *App
WithFlagIntSlice example: main.ext -names Bob -names Tom -names Lisa
func (*App) WithFlagString ¶
func (*App) WithFlagStringSlice ¶
func (*App) WithFlagUint ¶
func (*App) WithFlagUint64 ¶
func (*App) WithUsageErrorHandler ¶
func (app *App) WithUsageErrorHandler(handler UsageErrorHandler) *App
WithUsageErrorHandler Execute this function if a usage error occurs
type CommandNotFoundHandler ¶
type Config ¶
type Config struct { // The name of the program. Defaults to path.Base(os.Args[0]) Name string // Full name of command for help, defaults to Name HelpName string // Description of the program. Usage string // Text to override the USAGE section of help UsageText string // Description of the program argument format. ArgsUsage string // Version of the program Version string // Description of the program Description string // Boolean to enable bash completion commands EnableBashCompletion bool // Boolean to hide built-in help command HideHelp bool // Boolean to hide built-in version flag and the VERSION section of help HideVersion bool // Compilation date Compiled time.Time // List of all authors who contributed Authors []Author // Copyright of the binary if any Copyright string // Name of Author (Note: Use App.Authors, this is deprecated) Author string // Email of Author (Note: Use App.Authors, this is deprecated) Email string // Writer writer to write output to Writer io.Writer // ErrWriter writes error output ErrWriter io.Writer // CustomAppHelpTemplate the text template for app help topic. // cli.go uses text/template to render templates. You can // render custom help text by setting this variable. CustomAppHelpTemplate string // Boolean to enable short-option handling so user can combine several // single-character bool arguements into one // i.e. foobar -o -v -> foobar -ov UseShortOptionHandling bool }
type ExitErrHandlerFunc ¶
type Option ¶
type Option func(config *Config)
func WithArgsUsage ¶
func WithAuthor ¶
func WithAuthors ¶
func WithCompiled ¶
func WithCopyright ¶
func WithDescription ¶
func WithErrWriter ¶
func WithHelpName ¶
func WithHideHelp ¶
func WithHideVersion ¶
func WithUsageText ¶
func WithVersion ¶
func WithWriter ¶
Click to show internal directories.
Click to hide internal directories.