flagcodec

package
v0.4.10-1rc0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagToggle = iota
	FlagOption
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Flags

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

func ParseArgvKeyValue

func ParseArgvKeyValue(args []string) *Flags

func ParseArgvKeyValueWithCommand

func ParseArgvKeyValueWithCommand(command string, args []string) *Flags

ParseArgvKeyValue parses a clean (trimmed) argv whose components are either toggles or key=value pairs. IOW, this is a restricted and easier to parse flavour of argv on which option and value are guaranteed to be in the same item. IOW, we expect "--opt=foo" AND NOT "--opt", "foo"

func (*Flags) Args

func (fl *Flags) Args() []string

func (*Flags) Argv

func (fl *Flags) Argv() []string

func (*Flags) Command

func (fl *Flags) Command() string

func (*Flags) GetFlag

func (fl *Flags) GetFlag(name string) (Val, bool)

func (*Flags) SetOption

func (fl *Flags) SetOption(name, data string)

func (*Flags) SetToggle

func (fl *Flags) SetToggle(name string)

type Val

type Val struct {
	Kind int
	Data string
}

Jump to

Keyboard shortcuts

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