flagutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetFlagsFromEnv

func SetFlagsFromEnv(fs *flag.FlagSet, prefix string) (err error)

SetFlagsFromEnv parses all registered flags in the given flagset, and if they are not already set it attempts to set their values from environment variables. Environment variables take the name of the flag but are UPPERCASE, and any dashes are replaced by underscores. Environment variables additionally are prefixed by the given string followed by and underscore. For example, if prefix=PREFIX: some-flag => PREFIX_SOME_FLAG

Types

type IPv4Flag

type IPv4Flag struct {
	// contains filtered or unexported fields
}

IPv4Flag parses a string into a net.IP after asserting that it is an IPv4 address. This type implements the flag.Value interface.

func (*IPv4Flag) IP

func (f *IPv4Flag) IP() net.IP

func (*IPv4Flag) Set

func (f *IPv4Flag) Set(v string) error

func (*IPv4Flag) String

func (f *IPv4Flag) String() string

type StringSliceFlag

type StringSliceFlag []string

StringSliceFlag parses a comma-delimited list of strings into a []string. This type implements the flag.Value interface.

func (*StringSliceFlag) Set

func (ss *StringSliceFlag) Set(v string) error

func (*StringSliceFlag) String

func (ss *StringSliceFlag) String() string

Jump to

Keyboard shortcuts

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