flag

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2016 License: Apache-2.0 Imports: 5 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) 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 Base64

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

Base64 implements flag.Value, and is used to populate []byte values from baes64 encoded strings.

func NewBase64

func NewBase64(len int) *Base64

NewBase64 returns a Base64 which accepts values which decode to len byte strings.

func (*Base64) Bytes

func (f *Base64) Bytes() []byte

Bytes returns the set []byte value. If no value has been set, a nil []byte is returned.

func (*Base64) Set

func (f *Base64) Set(s string) error

Set will set the []byte value of the Base64 to the base64 decoded values of the string, returning an error if it cannot be decoded or is of the wrong length.

func (*Base64) String

func (f *Base64) String() string

type Base64List

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

Base64List implements flag.Value and is used to populate [][]byte values from a comma-separated list of base64 encoded strings.

func NewBase64List

func NewBase64List(len int) *Base64List

NewBase64List returns a Base64List which accepts a comma-separated list of strings which must decode to len byte strings.

func (*Base64List) BytesSlice

func (f *Base64List) BytesSlice() [][]byte

func (*Base64List) Set

func (f *Base64List) Set(ss string) error

Set will set the [][]byte value of the Base64List to the base64 decoded values of the comma-separated strings, returning an error on the first error it encounters.

func (*Base64List) String

func (f *Base64List) String() string

Jump to

Keyboard shortcuts

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