Documentation ¶
Index ¶
- type Command
- type ConfigOption
- type Option
- func Config(v interface{}) Option
- func Description(desc string) Option
- func Example(ex string) Option
- func GlobalConfig(v interface{}, cfos ...ConfigOption) Option
- func Long(desc string) Option
- func Name(names ...string) Option
- func PersistentPreRun(fn func(cmd *Command, args ...string)) Option
- func PreParseConfig() Option
- func PreRun(fn func(cmd *Command, args ...string)) Option
- func Run(fn func(cmd *Command, args ...string)) Option
- func SetFlags(setflag func(c *Command)) Option
- func Short(desc string) Option
- func Version(v string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
Command is the main struct which comes from cobar
func (*Command) InitFlags ¶ added in v0.2.8
func (c *Command) InitFlags()
InitFlags init flags from config
type ConfigOption ¶ added in v0.2.0
type ConfigOption func(co *configOptions)
ConfigOption defined config option for cli
func WithAutoFlags ¶ added in v0.3.24
func WithAutoFlags(v bool) ConfigOption
WithAutoFlags set auto register flags
func WithConfigChanged ¶ added in v0.2.1
func WithConfigChanged(f func(o, n interface{})) ConfigOption
WithConfigChanged set a watcher to watch the config changed params's type can be auto set with interface{}
func WithConfigName ¶ added in v0.2.0
func WithConfigName(names ...string) ConfigOption
WithConfigName set config name
type Option ¶
type Option func(c *Command)
Option set the command with value
func Config ¶ added in v0.0.8
func Config(v interface{}) Option
Config loads configuration from provider
func Description ¶
Description returns option to set descrtiption
func GlobalConfig ¶ added in v0.0.10
func GlobalConfig(v interface{}, cfos ...ConfigOption) Option
GlobalConfig ...
func PersistentPreRun ¶ added in v0.0.10
PersistentPreRun children of this command will inherit and execute.
func PreParseConfig ¶ added in v0.2.8
func PreParseConfig() Option
PreParseConfig is a option parse config
Source Files ¶
Click to show internal directories.
Click to hide internal directories.