Documentation ¶
Overview ¶
Package configo extends the standard flag package to include configuration file parsing and management.
Usage:
Usage is almost identical to the flag package: declare flags, parse flags, use flags. Command line flags override values parsed from a configuration file.
Configuration files consist of lines of key/value pairs, delimited by '='. The delimiter can be changed if needed by setting configo.SetDelimiter(). Blank lines and lines where the first non-whitespace character is '#' are ignored. Trailing comments are not allowed, however.
Index ¶
- func Bool(name string, value bool, usage string) *bool
- func BoolConfig(name string, value bool, usage string) *bool
- func BoolConfigVar(p *bool, name string, value bool, usage string)
- func BoolFlag(name string, value bool, usage string) *bool
- func BoolFlagVar(p *bool, name string, value bool, usage string)
- func BoolVar(p *bool, name string, value bool, usage string)
- func DefaultConfigPath() string
- func Duration(name string, value time.Duration, usage string) *time.Duration
- func DurationConfig(name string, value time.Duration, usage string) *time.Duration
- func DurationConfigVar(p *time.Duration, name string, value time.Duration, usage string)
- func DurationFlag(name string, value time.Duration, usage string) *time.Duration
- func DurationFlagVar(p *time.Duration, name string, value time.Duration, usage string)
- func DurationVar(p *time.Duration, name string, value time.Duration, usage string)
- func Float64(name string, value float64, usage string) *float64
- func Float64Config(name string, value float64, usage string) *float64
- func Float64ConfigVar(p *float64, name string, value float64, usage string)
- func Float64Flag(name string, value float64, usage string) *float64
- func Float64FlagVar(p *float64, name string, value float64, usage string)
- func Float64Var(p *float64, name string, value float64, usage string)
- func Int(name string, value int, usage string) *int
- func Int64(name string, value int64, usage string) *int64
- func Int64Config(name string, value int64, usage string) *int64
- func Int64ConfigVar(p *int64, name string, value int64, usage string)
- func Int64Flag(name string, value int64, usage string) *int64
- func Int64FlagVar(p *int64, name string, value int64, usage string)
- func Int64Var(p *int64, name string, value int64, usage string)
- func IntConfig(name string, value int, usage string) *int
- func IntConfigVar(p *int, name string, value int, usage string)
- func IntFlag(name string, value int, usage string) *int
- func IntFlagVar(p *int, name string, value int, usage string)
- func IntVar(p *int, name string, value int, usage string)
- func Parse() error
- func SetDelimiter(d string)
- func SetPath(path string)
- func String(name string, value string, usage string) *string
- func StringConfig(name string, value string, usage string) *string
- func StringConfigVar(p *string, name string, value string, usage string)
- func StringFlag(name string, value string, usage string) *string
- func StringFlagVar(p *string, name string, value string, usage string)
- func StringVar(p *string, name string, value string, usage string)
- func Uint(name string, value uint, usage string) *uint
- func Uint64(name string, value uint64, usage string) *uint64
- func Uint64Config(name string, value uint64, usage string) *uint64
- func Uint64ConfigVar(p *uint64, name string, value uint64, usage string)
- func Uint64Flag(name string, value uint64, usage string) *uint64
- func Uint64FlagVar(p *uint64, name string, value uint64, usage string)
- func Uint64Var(p *uint64, name string, value uint64, usage string)
- func UintConfig(name string, value uint, usage string) *uint
- func UintConfigVar(p *uint, name string, value uint, usage string)
- func UintFlag(name string, value uint, usage string) *uint
- func UintFlagVar(p *uint, name string, value uint, usage string)
- func UintVar(p *uint, name string, value uint, usage string)
- func Var(value flag.Value, name string, usage string, isFlag, isConfig bool)
- func Visit(fn func(*Configo))
- func VisitAll(fn func(*Configo))
- type Configo
- type ConfigoSet
- func (c *ConfigoSet) Arg(i int) string
- func (c *ConfigoSet) Args() []string
- func (c *ConfigoSet) Bool(name string, value bool, usage string) *bool
- func (c *ConfigoSet) BoolConfig(name string, value bool, usage string) *bool
- func (c *ConfigoSet) BoolConfigVar(p *bool, name string, value bool, usage string)
- func (c *ConfigoSet) BoolFlag(name string, value bool, usage string) *bool
- func (c *ConfigoSet) BoolFlagVar(p *bool, name string, value bool, usage string)
- func (c *ConfigoSet) BoolVar(p *bool, name string, value bool, usage string)
- func (c *ConfigoSet) Duration(name string, value time.Duration, usage string) *time.Duration
- func (c *ConfigoSet) DurationConfig(name string, value time.Duration, usage string) *time.Duration
- func (c *ConfigoSet) DurationConfigVar(p *time.Duration, name string, value time.Duration, usage string)
- func (c *ConfigoSet) DurationFlag(name string, value time.Duration, usage string) *time.Duration
- func (c *ConfigoSet) DurationFlagVar(p *time.Duration, name string, value time.Duration, usage string)
- func (c *ConfigoSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string)
- func (c *ConfigoSet) Float64(name string, value float64, usage string) *float64
- func (c *ConfigoSet) Float64Config(name string, value float64, usage string) *float64
- func (c *ConfigoSet) Float64ConfigVar(p *float64, name string, value float64, usage string)
- func (c *ConfigoSet) Float64Flag(name string, value float64, usage string) *float64
- func (c *ConfigoSet) Float64FlagVar(p *float64, name string, value float64, usage string)
- func (c *ConfigoSet) Float64Var(p *float64, name string, value float64, usage string)
- func (c *ConfigoSet) Int(name string, value int, usage string) *int
- func (c *ConfigoSet) Int64(name string, value int64, usage string) *int64
- func (c *ConfigoSet) Int64Config(name string, value int64, usage string) *int64
- func (c *ConfigoSet) Int64ConfigVar(p *int64, name string, value int64, usage string)
- func (c *ConfigoSet) Int64Flag(name string, value int64, usage string) *int64
- func (c *ConfigoSet) Int64FlagVar(p *int64, name string, value int64, usage string)
- func (c *ConfigoSet) Int64Var(p *int64, name string, value int64, usage string)
- func (c *ConfigoSet) IntConfig(name string, value int, usage string) *int
- func (c *ConfigoSet) IntConfigVar(p *int, name string, value int, usage string)
- func (c *ConfigoSet) IntFlag(name string, value int, usage string) *int
- func (c *ConfigoSet) IntFlagVar(p *int, name string, value int, usage string)
- func (c *ConfigoSet) IntVar(p *int, name string, value int, usage string)
- func (c *ConfigoSet) Lookup(name string) *Configo
- func (c *ConfigoSet) NArg() int
- func (c *ConfigoSet) NFlag() int
- func (c *ConfigoSet) Parse() (err error)
- func (c *ConfigoSet) Parsed() bool
- func (c *ConfigoSet) PrintDefaults()
- func (c *ConfigoSet) Set(name, value string) error
- func (c *ConfigoSet) String(name string, value string, usage string) *string
- func (c *ConfigoSet) StringConfig(name string, value string, usage string) *string
- func (c *ConfigoSet) StringConfigVar(p *string, name string, value string, usage string)
- func (c *ConfigoSet) StringFlag(name string, value string, usage string) *string
- func (c *ConfigoSet) StringFlagVar(p *string, name string, value string, usage string)
- func (c *ConfigoSet) StringVar(p *string, name string, value string, usage string)
- func (c *ConfigoSet) Uint(name string, value uint, usage string) *uint
- func (c *ConfigoSet) Uint64(name string, value uint64, usage string) *uint64
- func (c *ConfigoSet) Uint64Config(name string, value uint64, usage string) *uint64
- func (c *ConfigoSet) Uint64ConfigVar(p *uint64, name string, value uint64, usage string)
- func (c *ConfigoSet) Uint64Flag(name string, value uint64, usage string) *uint64
- func (c *ConfigoSet) Uint64FlagVar(p *uint64, name string, value uint64, usage string)
- func (c *ConfigoSet) Uint64Var(p *uint64, name string, value uint64, usage string)
- func (c *ConfigoSet) UintConfig(name string, value uint, usage string) *uint
- func (c *ConfigoSet) UintConfigVar(p *uint, name string, value uint, usage string)
- func (c *ConfigoSet) UintFlag(name string, value uint, usage string) *uint
- func (c *ConfigoSet) UintFlagVar(p *uint, name string, value uint, usage string)
- func (c *ConfigoSet) UintVar(p *uint, name string, value uint, usage string)
- func (c *ConfigoSet) Var(value flag.Value, name string, usage string, isFlag, isConfig bool)
- func (c *ConfigoSet) Visit(fn func(*Configo))
- func (c *ConfigoSet) VisitAll(fn func(*Configo))
- func (c *ConfigoSet) WriteDefaultConfig(path string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool defines a bool config item with specified name, default value, and usage string. The return value is the address of a bool variable that stores the value of the config item.
This item can be specified on the command line and in the configuration file.
func BoolConfig ¶
BoolConfig defines a bool config item with specified name, default value, and usage string. The return value is the address of a bool variable that stores the value of the config item.
func BoolConfigVar ¶
BoolConfigVar defines a bool config item with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.
This item can only be specified in the configuration file.
func BoolFlag ¶
BoolFlag defines a bool config item with specified name, default value, and usage string. The return value is the address of a bool variable that stores the value of the config item.
func BoolFlagVar ¶
BoolFlagVar defines a bool config item with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.
This item can only be specified on the command line.
func BoolVar ¶
BoolVar defines a bool config item with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.
This item can be specified on the command line and in the configuration file.
func DefaultConfigPath ¶
func DefaultConfigPath() string
defaultConfigPath returns the default configuration file path which is either in the current user's home directory, if there is a current user, or in the current working directory. The name of the config file will be the standard unix naming convention "." + {ProgramName} + "rc".
func Duration ¶
Duration defines a time.Duration flag with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the flag.
func DurationConfig ¶
Duration defines a time.Duration flag with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the flag.
func DurationConfigVar ¶
DurationVar defines a time.Duration flag with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the flag.
func DurationFlag ¶
Duration defines a time.Duration flag with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the flag.
func DurationFlagVar ¶
DurationVar defines a time.Duration flag with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the flag.
func DurationVar ¶
DurationVar defines a time.Duration flag with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the flag.
func Float64 ¶
Float64 defines a float64 flag with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the flag.
func Float64Config ¶
Float64 defines a float64 flag with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the flag.
func Float64ConfigVar ¶
Float64Var defines a float64 flag with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the flag.
func Float64Flag ¶
Float64 defines a float64 flag with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the flag.
func Float64FlagVar ¶
Float64Var defines a float64 flag with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the flag.
func Float64Var ¶
Float64Var defines a float64 flag with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the flag.
func Int ¶
Int defines an int flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag.
func Int64 ¶
Int64 defines an int64 flag with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the flag.
func Int64Config ¶
Int64 defines an int64 flag with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the flag.
func Int64ConfigVar ¶
Int64Var defines an int64 flag with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the flag.
func Int64Flag ¶
Int64 defines an int64 flag with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the flag.
func Int64FlagVar ¶
Int64Var defines an int64 flag with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the flag.
func Int64Var ¶
Int64Var defines an int64 flag with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the flag.
func IntConfig ¶
Int defines an int flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag.
func IntConfigVar ¶
IntVar defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.
func IntFlag ¶
Int defines an int flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag.
func IntFlagVar ¶
IntVar defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.
func IntVar ¶
IntVar defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.
func SetDelimiter ¶
func SetDelimiter(d string)
func String ¶
String defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.
func StringConfig ¶
String defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.
func StringConfigVar ¶
StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.
func StringFlag ¶
String defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.
func StringFlagVar ¶
StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.
func StringVar ¶
StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.
func Uint ¶
Uint defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.
func Uint64 ¶
Uint64 defines a uint64 flag with specified name, default value, and usage string. The return value is the address of a uint64 variable that stores the value of the flag.
func Uint64Config ¶
Uint64 defines a uint64 flag with specified name, default value, and usage string. The return value is the address of a uint64 variable that stores the value of the flag.
func Uint64ConfigVar ¶
Uint64Var defines a uint64 flag with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the flag.
func Uint64Flag ¶
Uint64 defines a uint64 flag with specified name, default value, and usage string. The return value is the address of a uint64 variable that stores the value of the flag.
func Uint64FlagVar ¶
Uint64Var defines a uint64 flag with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the flag.
func Uint64Var ¶
Uint64Var defines a uint64 flag with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the flag.
func UintConfig ¶
Uint defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.
func UintConfigVar ¶
UintVar defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.
func UintFlag ¶
Uint defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.
func UintFlagVar ¶
UintVar defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.
func UintVar ¶
UintVar defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.
func Var ¶
Var defines a flag with the specified name and usage string. The type and value of the flag are represented by the first argument, of type Value, which typically holds a user-defined implementation of Value. For instance, the caller could create a flag that turns a comma-separated string into a slice of strings by giving the slice the methods of Value; in particular, Set would decompose the comma-separated string into the slice. TODO This function does not appear to be used.
Types ¶
type Configo ¶
type Configo struct { Name string Usage string Value flag.Value DefaultValue string IsFlag bool IsConfig bool }
Configo is a single configuration item registered to a ConfigoSet.
type ConfigoSet ¶
type ConfigoSet struct { Usage func() // contains filtered or unexported fields }
ConfigoSet maintains the set of valid configuration options as well as those read in from a configuration file.
func NewConfigoSet ¶
func NewConfigoSet(name string, errorHandling flag.ErrorHandling, path string) *ConfigoSet
NewConfigoSet returns a new, empty configuration set with the specified name and error handling property.
func (*ConfigoSet) Arg ¶
func (c *ConfigoSet) Arg(i int) string
Arg returns the i'th command-line argument. Arg(0) is the first remaining argument after flags have been processed.
func (*ConfigoSet) Args ¶
func (c *ConfigoSet) Args() []string
Args returns the non-flag command-line arguments.
func (*ConfigoSet) Bool ¶
func (c *ConfigoSet) Bool(name string, value bool, usage string) *bool
Bool defines a bool configuration option with specified name, default value, and usage string. The isFlag and isConfig parameters control whether the option is valid on the command line and in the configuration file respectively.
This item can be specified on the command line and in the configuration file.
func (*ConfigoSet) BoolConfig ¶
func (c *ConfigoSet) BoolConfig(name string, value bool, usage string) *bool
BoolConfig defines a bool configuration option with specified name, default value, and usage string.
This item can only be specified in the configuration file.
func (*ConfigoSet) BoolConfigVar ¶
func (c *ConfigoSet) BoolConfigVar(p *bool, name string, value bool, usage string)
BoolConfigVar defines a bool config item with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.
This item can only be specified in the configuration file.
func (*ConfigoSet) BoolFlag ¶
func (c *ConfigoSet) BoolFlag(name string, value bool, usage string) *bool
BoolFlag defines a bool configuration option with specified name, default value, and usage string.
This item can only be specified on the command line.
func (*ConfigoSet) BoolFlagVar ¶
func (c *ConfigoSet) BoolFlagVar(p *bool, name string, value bool, usage string)
BoolFlagVar defines a bool command line flag item with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.
This item can only be specified on the command line.
func (*ConfigoSet) BoolVar ¶
func (c *ConfigoSet) BoolVar(p *bool, name string, value bool, usage string)
BoolVar defines a bool config item with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.
This item can be specified on the command line and in the configuration file.
func (*ConfigoSet) Duration ¶
Duration defines a time.Duration flag with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the flag.
func (*ConfigoSet) DurationConfig ¶
Duration defines a time.Duration flag with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the flag.
func (*ConfigoSet) DurationConfigVar ¶
func (c *ConfigoSet) DurationConfigVar(p *time.Duration, name string, value time.Duration, usage string)
DurationVar defines a time.Duration flag with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the flag.
func (*ConfigoSet) DurationFlag ¶
Duration defines a time.Duration flag with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the flag.
func (*ConfigoSet) DurationFlagVar ¶
func (c *ConfigoSet) DurationFlagVar(p *time.Duration, name string, value time.Duration, usage string)
DurationVar defines a time.Duration flag with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the flag.
func (*ConfigoSet) DurationVar ¶
DurationVar defines a time.Duration flag with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the flag.
func (*ConfigoSet) Float64 ¶
func (c *ConfigoSet) Float64(name string, value float64, usage string) *float64
Float64 defines a float64 flag with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the flag.
func (*ConfigoSet) Float64Config ¶
func (c *ConfigoSet) Float64Config(name string, value float64, usage string) *float64
Float64 defines a float64 flag with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the flag.
func (*ConfigoSet) Float64ConfigVar ¶
func (c *ConfigoSet) Float64ConfigVar(p *float64, name string, value float64, usage string)
Float64Var defines a float64 flag with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the flag.
func (*ConfigoSet) Float64Flag ¶
func (c *ConfigoSet) Float64Flag(name string, value float64, usage string) *float64
Float64 defines a float64 flag with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the flag.
func (*ConfigoSet) Float64FlagVar ¶
func (c *ConfigoSet) Float64FlagVar(p *float64, name string, value float64, usage string)
Float64Var defines a float64 flag with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the flag.
func (*ConfigoSet) Float64Var ¶
func (c *ConfigoSet) Float64Var(p *float64, name string, value float64, usage string)
Float64Var defines a float64 flag with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the flag.
func (*ConfigoSet) Int ¶
func (c *ConfigoSet) Int(name string, value int, usage string) *int
Int defines an int flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag.
func (*ConfigoSet) Int64 ¶
func (c *ConfigoSet) Int64(name string, value int64, usage string) *int64
Int64 defines an int64 flag with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the flag.
func (*ConfigoSet) Int64Config ¶
func (c *ConfigoSet) Int64Config(name string, value int64, usage string) *int64
Int64 defines an int64 flag with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the flag.
func (*ConfigoSet) Int64ConfigVar ¶
func (c *ConfigoSet) Int64ConfigVar(p *int64, name string, value int64, usage string)
Int64Var defines an int64 flag with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the flag.
func (*ConfigoSet) Int64Flag ¶
func (c *ConfigoSet) Int64Flag(name string, value int64, usage string) *int64
Int64 defines an int64 flag with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the flag.
func (*ConfigoSet) Int64FlagVar ¶
func (c *ConfigoSet) Int64FlagVar(p *int64, name string, value int64, usage string)
Int64Var defines an int64 flag with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the flag.
func (*ConfigoSet) Int64Var ¶
func (c *ConfigoSet) Int64Var(p *int64, name string, value int64, usage string)
Int64Var defines an int64 flag with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the flag.
func (*ConfigoSet) IntConfig ¶
func (c *ConfigoSet) IntConfig(name string, value int, usage string) *int
Int defines an int flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag.
func (*ConfigoSet) IntConfigVar ¶
func (c *ConfigoSet) IntConfigVar(p *int, name string, value int, usage string)
IntConfigVar defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.
func (*ConfigoSet) IntFlag ¶
func (c *ConfigoSet) IntFlag(name string, value int, usage string) *int
Int defines an int flag with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the flag.
func (*ConfigoSet) IntFlagVar ¶
func (c *ConfigoSet) IntFlagVar(p *int, name string, value int, usage string)
IntFlagVar defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.
func (*ConfigoSet) IntVar ¶
func (c *ConfigoSet) IntVar(p *int, name string, value int, usage string)
IntVar defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.
func (*ConfigoSet) Lookup ¶
func (c *ConfigoSet) Lookup(name string) *Configo
Lookup returns the Configo structure of the named configo, returning nil if none exists.
func (*ConfigoSet) NArg ¶
func (c *ConfigoSet) NArg() int
NArg is the number of arguments remaining after flags have been processed.
func (*ConfigoSet) NFlag ¶
func (c *ConfigoSet) NFlag() int
NFlag returns the number of command-line flags that have been set.
func (*ConfigoSet) Parse ¶
func (c *ConfigoSet) Parse() (err error)
Parse parses the command-line flags from os.Args[1:] and sets the values in this ConfigoSet. Then the configuration file is parsed and any item that was not already set by the command line is set. Must be called after all configuration options are defined and before conifguration options are accessed by the program.
func (*ConfigoSet) Parsed ¶
func (c *ConfigoSet) Parsed() bool
Parsed returns true if the configuration file and command-line flags have been parsed.
func (*ConfigoSet) PrintDefaults ¶
func (c *ConfigoSet) PrintDefaults()
PrintDefaults prints to standard error the default values of all defined command-line flags.
func (*ConfigoSet) Set ¶
func (c *ConfigoSet) Set(name, value string) error
Set sets the value of the named configuration item.
func (*ConfigoSet) String ¶
func (c *ConfigoSet) String(name string, value string, usage string) *string
String defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.
func (*ConfigoSet) StringConfig ¶
func (c *ConfigoSet) StringConfig(name string, value string, usage string) *string
String defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.
func (*ConfigoSet) StringConfigVar ¶
func (c *ConfigoSet) StringConfigVar(p *string, name string, value string, usage string)
StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.
func (*ConfigoSet) StringFlag ¶
func (c *ConfigoSet) StringFlag(name string, value string, usage string) *string
String defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.
func (*ConfigoSet) StringFlagVar ¶
func (c *ConfigoSet) StringFlagVar(p *string, name string, value string, usage string)
StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.
func (*ConfigoSet) StringVar ¶
func (c *ConfigoSet) StringVar(p *string, name string, value string, usage string)
StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.
func (*ConfigoSet) Uint ¶
func (c *ConfigoSet) Uint(name string, value uint, usage string) *uint
Uint defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.
func (*ConfigoSet) Uint64 ¶
func (c *ConfigoSet) Uint64(name string, value uint64, usage string) *uint64
Uint64 defines a uint64 flag with specified name, default value, and usage string. The return value is the address of a uint64 variable that stores the value of the flag.
func (*ConfigoSet) Uint64Config ¶
func (c *ConfigoSet) Uint64Config(name string, value uint64, usage string) *uint64
Uint64 defines a uint64 flag with specified name, default value, and usage string. The return value is the address of a uint64 variable that stores the value of the flag.
func (*ConfigoSet) Uint64ConfigVar ¶
func (c *ConfigoSet) Uint64ConfigVar(p *uint64, name string, value uint64, usage string)
Uint64Var defines a uint64 flag with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the flag.
func (*ConfigoSet) Uint64Flag ¶
func (c *ConfigoSet) Uint64Flag(name string, value uint64, usage string) *uint64
Uint64 defines a uint64 flag with specified name, default value, and usage string. The return value is the address of a uint64 variable that stores the value of the flag.
func (*ConfigoSet) Uint64FlagVar ¶
func (c *ConfigoSet) Uint64FlagVar(p *uint64, name string, value uint64, usage string)
Uint64Var defines a uint64 flag with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the flag.
func (*ConfigoSet) Uint64Var ¶
func (c *ConfigoSet) Uint64Var(p *uint64, name string, value uint64, usage string)
Uint64Var defines a uint64 flag with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the flag.
func (*ConfigoSet) UintConfig ¶
func (c *ConfigoSet) UintConfig(name string, value uint, usage string) *uint
Uint defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.
func (*ConfigoSet) UintConfigVar ¶
func (c *ConfigoSet) UintConfigVar(p *uint, name string, value uint, usage string)
UintVar defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.
func (*ConfigoSet) UintFlag ¶
func (c *ConfigoSet) UintFlag(name string, value uint, usage string) *uint
Uint defines a uint flag with specified name, default value, and usage string. The return value is the address of a uint variable that stores the value of the flag.
func (*ConfigoSet) UintFlagVar ¶
func (c *ConfigoSet) UintFlagVar(p *uint, name string, value uint, usage string)
UintVar defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.
func (*ConfigoSet) UintVar ¶
func (c *ConfigoSet) UintVar(p *uint, name string, value uint, usage string)
UintVar defines a uint flag with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the flag.
func (*ConfigoSet) Var ¶
Var defines a flag with the specified name and usage string. The type and value of the flag are represented by the first argument, of type Value, which typically holds a user-defined implementation of Value. For instance, the caller could create a flag that turns a comma-separated string into a slice of strings by giving the slice the methods of Value; in particular, Set would decompose the comma-separated string into the slice.
func (*ConfigoSet) Visit ¶
func (c *ConfigoSet) Visit(fn func(*Configo))
Visit visits the command-line flags in lexicographical order, calling fn for each. It visits only those flags that have been set.
func (*ConfigoSet) VisitAll ¶
func (c *ConfigoSet) VisitAll(fn func(*Configo))
VisitAll visits the command-line flags in lexicographical order, calling fn for each. It visits all flags, even those not set.
func (*ConfigoSet) WriteDefaultConfig ¶
func (c *ConfigoSet) WriteDefaultConfig(path string) (err error)
WriteDefaultConfig writes a config file to c.path which contains all of the defined configuration items with their default values, including usage comments.