options

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadGroup = errors.New("only the last short flag in a group can have an argument")

ErrBadGroup indicated that more than one short flag in a group expects an argument

View Source
var ErrBoolArg = errors.New("args cannot be bool values")

ErrBoolArg indicates that an argument is a bool (unsupported)

View Source
var ErrInsufficientArgs = errors.New("Missing argument(s)")

ErrInsufficientArgs indicates that not enough arguments were provided for this subcommand

View Source
var ErrMissingFlagName = errors.New("missing flag name")

ErrMissingFlagName indicates that no flag name was provided

View Source
var ErrMissingValue = errors.New("missing value for field")

ErrMissingValue indicates that a flag does not have an associated value

View Source
var ErrSliceFlag = errors.New("flags cannot be slices")

ErrSliceFlag indicates that a flag has been given a slice type

View Source
var ErrTooManyArgs = errors.New("too many arguments")

ErrTooManyArgs indicates that too many arguments were provided for this subcommand

Functions

This section is empty.

Types

type List

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

List is a Queue of arguments, used druing parsing

func NewList

func NewList(args []string) List

NewList creats a list with the included arguments

func (List) IsEmpty

func (l List) IsEmpty() bool

IsEmpty checks if there are any remaining elements

func (*List) Next

func (l *List) Next() (front string)

Next returns the element at the front of the list, after popping it off

func (List) Peek

func (l List) Peek() string

Peek returns the element at the front of the list

type Parser

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

Parser can be used to read and convert the raw program arguments

func NewParser

func NewParser(args []string, single bool) (p *Parser, sub string)

NewParser does the initial parsing of arguments and returns the resulting Parser

func (*Parser) Parse

func (p *Parser) Parse(rFlags, cFlags, args interface{}) (err error)

Parse processes arguments and sets flags and subcommand args as needed

Jump to

Keyboard shortcuts

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