Documentation ¶
Overview ¶
Package moreflag contains definitions for some useful flag types, such as maps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
func Parse()
Parse parses flags which are set in environment variables using the FLAG_ prefix. That is for a flag named x, x=$FLAG_x if $FLAG_x is set. If the flag is set in the command line, the command line value of the flag takes precedence over the environment variable value. It also calls flag.CommandLine.Parse() to parse flags sent directly as arguments, unless flag.Parse has been previously called.
func ParseFromEnv ¶
func ParseFromEnv()
ParseFromEnv parses flags which are set in environment variables using the FLAG_ prefix. That is for a flag named x, x=$FLAG_x if $FLAG_x is set. If the flag is set in the command line, the command line value of the flag takes precedence over the environment variable value.
Types ¶
type StringListValue ¶
type StringListValue []string
StringListValue is a command line flag that interprets a string as a list of comma-separated values.
func (*StringListValue) Get ¶
func (m *StringListValue) Get() interface{}
Get returns the flag value as a list of strings.
func (*StringListValue) Set ¶
func (m *StringListValue) Set(s string) error
Set for StringListValue accepts one list of comma-separated values.
func (*StringListValue) String ¶
func (m *StringListValue) String() string
String returns the list value.
type StringMapValue ¶
StringMapValue is a command line flag that interprets a string in the format key1=value1,key2=value2 as a map.
func (*StringMapValue) Get ¶
func (m *StringMapValue) Get() interface{}
Get returns the flag value as a map of strings.
func (*StringMapValue) Set ¶
func (m *StringMapValue) Set(s string) error
Set updates the map with key and value pair(s) in the format key1=value1,key2=value2.
func (*StringMapValue) String ¶
func (m *StringMapValue) String() string
String retrieves the flag's map in the format key1=value1,key2=value, sorted by keys.