configo

package module
v0.0.0-...-a339915 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2014 License: MIT Imports: 12 Imported by: 0

README

configo

Simple configuration files AND command line parsing for Go.

The same API provided by the flag package, extended for use with configuration files. Use a single function to setup a command line flag and configuration file option simultaneously. Create default configuration files automatically.

Get the source

$ go get githib.com/quincy/configo

Usage

// file: example.go
package main

import (
    "fmt"
    "github.com/quincy/configo"
)

var species = configo.String("species", "gopher", "the species we are studying")

configo.SetDelimiter(":")  // Default is "="
configo.Parse()

fmt.Printf("Value of species is %s\n", species)

The first time your program is run a default config file will be created with all options set to defaults, commented with the usage text.

$ go run example.go
Value of species is gopher
$ cat ~/.examplerc
# Default config file for example
# Written on 07 Aug 13 20:15 -0600

# the species we are studying
species:gopher

The command line arguments override those found in the config file.

$ go run example.go -species=mole
Value of species is mole

See example/example.go for more complicated examples.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(name string, value bool, usage string) *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

func BoolConfig(name string, value bool, usage string) *bool

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

func 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 BoolFlag

func BoolFlag(name string, value bool, usage string) *bool

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

func BoolFlagVar(p *bool, name string, value bool, usage string)

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

func 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 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

func Duration(name string, value time.Duration, usage string) *time.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

func DurationConfig(name string, value time.Duration, usage string) *time.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 DurationConfigVar

func 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 DurationFlag

func DurationFlag(name string, value time.Duration, usage string) *time.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 DurationFlagVar

func 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 DurationVar

func DurationVar(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 Float64

func 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 Float64Config

func 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 Float64ConfigVar

func 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 Float64Flag

func 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 Float64FlagVar

func 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 Float64Var

func 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 Int

func 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 Int64

func 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 Int64Config

func 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 Int64ConfigVar

func 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 Int64Flag

func 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 Int64FlagVar

func 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 Int64Var

func 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 IntConfig

func 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 IntConfigVar

func IntConfigVar(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 IntFlag

func 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 IntFlagVar

func IntFlagVar(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 IntVar

func 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 Parse

func Parse() error

func SetDelimiter

func SetDelimiter(d string)

func SetPath

func SetPath(path string)

SetPath sets the path to the configuration file.

func String

func 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 StringConfig

func 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 StringConfigVar

func 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 StringFlag

func 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 StringFlagVar

func 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 StringVar

func 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 Uint

func 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 Uint64

func 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 Uint64Config

func 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 Uint64ConfigVar

func 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 Uint64Flag

func 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 Uint64FlagVar

func 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 Uint64Var

func 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 UintConfig

func 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 UintConfigVar

func 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 UintFlag

func 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 UintFlagVar

func 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 UintVar

func 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 Var

func Var(value flag.Value, name string, usage string, isFlag, isConfig bool)

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.

func Visit

func 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 VisitAll

func VisitAll(fn func(*Configo))

VisitAll visits the configuration items in lexicographical order, calling fn for each. It visits all flags, even those not set.

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.

func Lookup

func Lookup(name string) *Configo

Lookup returns the Configo structure of the named configuration item, returning nil if none exists.

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

func (c *ConfigoSet) Duration(name string, value time.Duration, usage string) *time.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

func (c *ConfigoSet) DurationConfig(name string, value time.Duration, usage string) *time.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) 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

func (c *ConfigoSet) DurationFlag(name string, value time.Duration, usage string) *time.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) 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

func (c *ConfigoSet) DurationVar(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) 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

func (c *ConfigoSet) Var(value flag.Value, name string, usage string, isFlag, isConfig bool)

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL