flags

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Int64List

type Int64List []int64

func (Int64List) Int64s

func (s Int64List) Int64s() []int64

func (*Int64List) Set

func (s *Int64List) Set(v string) error

func (*Int64List) String

func (s *Int64List) String() string

type IntList

type IntList []int

func (IntList) Ints

func (s IntList) Ints() []int

func (*IntList) Set

func (s *IntList) Set(v string) error

func (*IntList) String

func (s *IntList) String() string

type OptionalBool

type OptionalBool struct {
	IsSet bool
	Value bool
}

OptionalBool is an bool flag that lets you to tell if the flag has been set or not, unlike flag.BoolVar(), which does not.

OptionalBool can distinguish between all three of these conditions:

$ prog -bool=true
$ prog -bool=false
$ prog

OptionalBool supports, but can not distinguish, this additional condition:

$ prog -bool

Like flag.BoolVar(), OptionalBool does not support these conditions:

$ prog -bool true
$ prog -bool false

func (*OptionalBool) IsBoolFlag

func (s *OptionalBool) IsBoolFlag() bool

func (*OptionalBool) Set

func (s *OptionalBool) Set(x string) error

func (*OptionalBool) String

func (s *OptionalBool) String() string

type OptionalFloat64

type OptionalFloat64 struct {
	IsSet bool
	Value float64
	// contains filtered or unexported fields
}

OptionalFloat64 is a float64 flag that lets you to tell if the flag has been set or not, unlike flag.Float64Var(), which does not.

OptionalFloat64 can distinguish between all three of these conditions:

$ prog -float64 1.1
$ prog -float64 0
$ prog

func (*OptionalFloat64) Set

func (s *OptionalFloat64) Set(x string) error

func (*OptionalFloat64) String

func (s *OptionalFloat64) String() string

type OptionalInt

type OptionalInt struct {
	IsSet bool
	Value int
	// contains filtered or unexported fields
}

OptionalInt is an int flag that lets you to tell if the flag has been set or not, unlike flag.IntVar(), which does not.

OptionalInt can distinguish between all three of these conditions:

$ prog -int 1
$ prog -int 0
$ prog -int ""

func (*OptionalInt) Set

func (s *OptionalInt) Set(x string) error

func (*OptionalInt) String

func (s *OptionalInt) String() string

type OptionalInt64

type OptionalInt64 struct {
	IsSet bool
	Value int64
	// contains filtered or unexported fields
}

OptionalInt64 is an int flag that lets you to tell if the flag has been set or not, unlike flag.Int64Var(), which does not.

OptionalInt64 can distinguish between all three of these conditions:

$ prog -int64 1
$ prog -int64 0
$ prog -int64 ""

func (*OptionalInt64) Set

func (s *OptionalInt64) Set(x string) error

func (*OptionalInt64) String

func (s *OptionalInt64) String() string

type OptionalString

type OptionalString struct {
	IsSet bool
	Value string
}

OptionalString is a string flag that lets you to tell if the flag has been set or not, unlike flag.StringVar(), which does not.

OptionalString can distinguish between all three of these conditions:

$ prog -flag foo
$ prog -flag ""j
$ prog

func (*OptionalString) Set

func (s *OptionalString) Set(x string) error

func (*OptionalString) String

func (s *OptionalString) String() string

type OptionalUint

type OptionalUint struct {
	IsSet bool
	Value uint
	// contains filtered or unexported fields
}

OptionalUint is an int flag that lets you to tell if the flag has been set or not, unlike flag.UintVar(), which does not.

OptionalUint can distinguish between all three of these conditions:

$ prog -uint 1
$ prog -uint 0
$ prog -uint ""

func (*OptionalUint) Set

func (s *OptionalUint) Set(x string) error

func (*OptionalUint) String

func (s *OptionalUint) String() string

type OptionalUint64

type OptionalUint64 struct {
	IsSet bool
	Value uint64
	// contains filtered or unexported fields
}

OptionalUint64 is an int flag that lets you to tell if the flag has been set or not, unlike flag.Uint64Var(), which does not.

OptionalUint64 can distinguish between all three of these conditions:

$ prog -uint64 1
$ prog -uint64 0
$ prog

func (*OptionalUint64) Set

func (s *OptionalUint64) Set(x string) error

func (*OptionalUint64) String

func (s *OptionalUint64) String() string

type StringList

type StringList []string

func (*StringList) Set

func (s *StringList) Set(v string) error

func (*StringList) String

func (s *StringList) String() string

func (StringList) Strings

func (s StringList) Strings() []string

Jump to

Keyboard shortcuts

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