cli

package
v0.0.0-...-4e58735 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagTag    = "flag"
	UsageTag   = "usage"
	DefaultTag = "default"

	FlagError     errors.Kind = "flag error"
	ErrNilFlagSet errors.Msg  = "FlagSet must not be nil"
)
View Source
const Unsupported = "<unsupported>"

Variables

This section is empty.

Functions

func ParseTag

func ParseTag(tag string) (ln string, sn string, err error)

ParseTag parses tag to a long (ln) and short (sn) flag name.

Types

type Cli

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

func CommandLine

func CommandLine() *Cli

CommandLine calls Flags with cli.CommandLine as FlagSet and os.Args[1:] as args. See Flags for further details.

func Flags

func Flags(fs FlagSet, args []string) *Cli

Flags returns a Processor that uses the provided FlagSet to set the values from args to the matching Configure.Fields. It replaces any previously set values.

func New

func New(name string, args []string) *Cli

func (*Cli) Configure

func (c *Cli) Configure(v interface{}) error

func (*Cli) Usage

func (c *Cli) Usage() string

type FlagSet

type FlagSet interface {
	Args() []string
	Var(val flag.Value, name, usage string)
	Parse(args []string) error
	Parsed() bool
}

Jump to

Keyboard shortcuts

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