flag

package
v1.4.1-prerelease26 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RepeatedStringFlag

type RepeatedStringFlag struct {
	Name  string
	Usage string
}

RepeatedStringFlag is a cli.Flag for repeatable string values that does NOT split on commas. Each Apply creates a fresh StringSlice to prevent cross-run accumulation when the flag is defined as a package-level var.

func (*RepeatedStringFlag) Apply

func (f *RepeatedStringFlag) Apply(set *goflag.FlagSet) error

Apply registers a fresh StringSlice with the flag set on every call, preventing cross-run accumulation when the flag is a package-level var.

func (*RepeatedStringFlag) IsSet

func (f *RepeatedStringFlag) IsSet() bool

IsSet always returns false; c.IsSet() uses fs.Visit which is the authoritative check for whether the flag appeared on the command line.

func (*RepeatedStringFlag) Names

func (f *RepeatedStringFlag) Names() []string

func (*RepeatedStringFlag) String

func (f *RepeatedStringFlag) String() string

type StringMap

type StringMap map[string]string

func (*StringMap) Set

func (m *StringMap) Set(value string) error

Set resets the map before parsing. This is intentional: StringMap is used as a GenericFlag.Value on package-level vars; without a reset, values from a previous app.Run() call accumulate into the next parse. The reset also makes Set idempotent when urfave/cli's normalizeFlags copies the flag value to aliases via Set(String()) — see String() below.

func (*StringMap) String

func (m *StringMap) String() string

String returns the map in key1=v1,key2=v2 format so that it round-trips cleanly through Set. urfave/cli's normalizeFlags propagates a flag's value to its aliases by calling Set(String()), so returning the Go default map representation (map[k:v]) would cause Set to fail and wipe the map.

func (*StringMap) Value

func (m *StringMap) Value() map[string]string

type StringSlice

type StringSlice []string

func (*StringSlice) Set

func (s *StringSlice) Set(value string) error

func (*StringSlice) String

func (s *StringSlice) String() string

func (*StringSlice) Value

func (s *StringSlice) Value() []string

Jump to

Keyboard shortcuts

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