Documentation ¶
Overview ¶
Package option provides utilities of option handling
Index ¶
- Variables
- func RegisterBoolFlag(cmd *cobra.Command, flagConfig *BoolFlag) error
- func RegisterIntFlag(cmd *cobra.Command, flagConfig *IntFlag) error
- func RegisterStringFlag(cmd *cobra.Command, flagConfig *StringFlag) error
- type BoolFlag
- type CmdConfig
- type CmdRawConfig
- type Flag
- type GetCmdConfig
- type ImagesCmdConfig
- type ImagesRawCmdConfig
- type IntFlag
- type PrintCmdConfig
- type SearchCmdConfig
- type SearchRawCmdConfig
- type SetCmdConfig
- type StringFlag
Constants ¶
This section is empty.
Variables ¶
var DefaultStringValue = "__DEFAULT_STRING_VALUE__"
Functions ¶
func RegisterBoolFlag ¶
RegisterBoolFlag register bool flag to provided cmd and viper
func RegisterIntFlag ¶
RegisterIntFlag register int flag to provided cmd and viper
func RegisterStringFlag ¶
func RegisterStringFlag(cmd *cobra.Command, flagConfig *StringFlag) error
RegisterStringFlag register string flag to provided cmd and viper
Types ¶
type CmdRawConfig ¶
type CmdRawConfig struct { SearchRawCmdConfig `mapstructure:",squash"` ImagesRawCmdConfig `mapstructure:",squash"` Toggle bool DBPath string }
type Flag ¶
type Flag struct { IsPersistent bool IsRequired bool IsDirName bool IsFileName bool Shorthand string Name string ViperName string Usage string }
Flag represents flag which can be specified
type GetCmdConfig ¶
type GetCmdConfig struct {
DBPath string
}
GetCmdConfig is config for sum command
func NewGetCmdConfigFromViper ¶
func NewGetCmdConfigFromViper() (*GetCmdConfig, error)
NewGetCmdConfigFromViper generate config for sum command from viper
type ImagesCmdConfig ¶
type ImagesCmdConfig struct { *ImagesRawCmdConfig DBPath string }
ImagesCmdConfig is config for sum command
func NewImagesCmdConfigFromViper ¶
func NewImagesCmdConfigFromViper() (*ImagesCmdConfig, error)
NewImagesCmdConfigFromViper generate config for sum command from viper
type ImagesRawCmdConfig ¶
type ImagesRawCmdConfig struct {
Dir string
}
ImagesRawCmdConfig is raw config for sum command
type PrintCmdConfig ¶
type PrintCmdConfig struct {
DBPath string
}
PrintCmdConfig is config for sum command
func NewPrintCmdConfigFromViper ¶
func NewPrintCmdConfigFromViper() (*PrintCmdConfig, error)
NewPrintCmdConfigFromViper generate config for sum command from viper
type SearchCmdConfig ¶
type SearchCmdConfig struct { *SearchRawCmdConfig Excludes []string Filters []string DBPath string }
SearchCmdConfig is config for search command
func NewSearchCmdConfigFromViper ¶
func NewSearchCmdConfigFromViper() (*SearchCmdConfig, error)
NewSearchCmdConfigFromViper generate config for search command from viper
type SearchRawCmdConfig ¶
type SearchRawCmdConfig struct { Query string Exclude string Interval int Filter string ConsumerKey string ConsumerSecret string AccessToken string AccessTokenSecret string }
SearchCmdConfig is raw config for search command
type SetCmdConfig ¶
type SetCmdConfig struct {
DBPath string
}
SetCmdConfig is config for sum command
func NewSetCmdConfigFromViper ¶
func NewSetCmdConfigFromViper() (*SetCmdConfig, error)
NewSetCmdConfigFromViper generate config for sum command from viper
type StringFlag ¶
StringFlag represents flag which can be specified as string