Documentation ¶
Overview ¶
Package option provides utilities of option handling
Index ¶
- Variables
- func RegisterBoolFlag(cmd *cobra.Command, flagConfig *BoolFlag) error
- func RegisterInt64Flag(cmd *cobra.Command, flagConfig *Int64Flag) error
- func RegisterStringFlag(cmd *cobra.Command, flagConfig *StringFlag) error
- type BoolFlag
- type CmdConfig
- type CmdRawConfig
- type Flag
- type Int64Flag
- type StartCmdConfig
- type StringFlag
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultStringValue = "__DEFAULT_STRING_VALUE__"
Functions ¶
func RegisterBoolFlag ¶
RegisterBoolFlag register bool flag to provided cmd and viper
func RegisterInt64Flag ¶
RegisterInt64Flag register int64 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 { StartCmdConfig `mapstructure:",squash"` Toggle bool }
type Flag ¶
type Flag struct { IsPersistent bool IsRequired bool Shorthand string Name string Usage string ViperName string }
Flag represents flag which can be specified
type StartCmdConfig ¶
type StartCmdConfig struct { TwitterConsumerKey string `mapstructure:"TWITTER_CONSUMER_KEY"` TwitterConsumerSecret string `mapstructure:"TWITTER_CONSUMER_SECRET"` BotTwitterAccessToken string `mapstructure:"BOT_TWITTER_ACCESS_TOKEN"` BotTwitterAccessTokenSecret string `mapstructure:"BOT_TWITTER_ACCESS_TOKEN_SECRET"` ErrorTweetMessage string `mapstructure:"ERROR_TWEET_MESSAGE"` SorryTweetMessage string `mapstructure:"SORRY_TWEET_MESSAGE"` TweetKeyword string `mapstructure:"TWEET_KEYWORD"` BotTwitterUserID int64 `mapstructure:"BOT_TWITTER_USER_ID"` BotTwitterUserScreenName string `mapstructure:"BOT_TWITTER_USER_SCREEN_NAME"` ClassifierServerHost string `mapstructure:"CLASSIFIER_SERVER_HOST"` Port string `mapstructure:"PORT"` }
StartCmdConfig is config for start command
func NewStartCmdConfigFromViper ¶
func NewStartCmdConfigFromViper() (*StartCmdConfig, error)
NewStartCmdConfigFromViper generate config for start command from viper
Click to show internal directories.
Click to hide internal directories.