Documentation ¶
Index ¶
- func FormatUseName(basename string) string
- type App
- type CliOptions
- type Command
- type CommandOption
- type CompletableOptions
- type ConfigurableOptions
- type Option
- func WithDefaultValidArgs() Option
- func WithLong(desc string) Option
- func WithOptions(opt CliOptions) Option
- func WithRunFunc(runFunc RunFunc) Option
- func WithSilence(silence bool) Option
- func WithUseConfig(useConfig bool) Option
- func WithValidArgs(args cobra.PositionalArgs) Option
- func WithVersion(version bool) Option
- type PrintableOptions
- type RunCommandFunc
- type RunFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CliOptions ¶
type CliOptions interface { Flags() (fss flag.NamedFlagSets) Validate() []error }
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func NewCommand(use, short string, opts ...CommandOption) *Command
NewCommand 用于生成 Command
func (Command) AddCommands ¶
AddCommands AddCommand 用于追加 command
type CommandOption ¶
type CommandOption func(*Command)
func WithCommandOptions ¶
func WithCommandOptions(opt CliOptions) CommandOption
func WithCommandRunFunc ¶
func WithCommandRunFunc(rcf RunCommandFunc) CommandOption
type CompletableOptions ¶
type CompletableOptions interface {
Complete() error
}
CompletableOptions abstracts options, which can be completed.
type ConfigurableOptions ¶
type ConfigurableOptions interface { // ApplyFlags parsing parameters from the command line or configuration file // to the options instance. ApplyFlags() []error }
ConfigurableOptions abstracts configuration options for reading parameters from a configuration file.
type Option ¶
type Option func(*App)
func WithDefaultValidArgs ¶
func WithDefaultValidArgs() Option
func WithOptions ¶
func WithOptions(opt CliOptions) Option
func WithRunFunc ¶
func WithSilence ¶
func WithUseConfig ¶
func WithValidArgs ¶
func WithValidArgs(args cobra.PositionalArgs) Option
func WithVersion ¶
type PrintableOptions ¶
type PrintableOptions interface {
String() string
}
PrintableOptions abstracts options, which can be printed.
type RunCommandFunc ¶
Click to show internal directories.
Click to hide internal directories.