Documentation ¶
Overview ¶
Package flagslice defines slice types to be used as custom flag types for the flag library.
Slice types as custom flag types allow a flag to be passed multiple times, e.g. to accept multiple options.
var fOpts = &flagslice.FlagStringSlice{} flag.Var(fOpts, "o", "Options in key/value form, can be passed multiple times") flag.Parse() for i, fOpt := range fOpts.Slice() { log.Printf("Passed value no. %d: %s", i, fOpt) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlagStringSlice ¶
type FlagStringSlice []string
FlagStringSlice implements the flags.Value interface. Each occurrence of a flag of this type will append the given parameter to the flags' value.
func (*FlagStringSlice) Set ¶
func (fss *FlagStringSlice) Set(value string) error
Set appends the given value to the FlagStringSlice.
func (FlagStringSlice) Slice ¶
func (fss FlagStringSlice) Slice() []string
Slice returns the FlagStringSlice as a string slice.
func (FlagStringSlice) String ¶
func (fss FlagStringSlice) String() string
String implements the Stringer interface.
Click to show internal directories.
Click to hide internal directories.