argparse

package
v0.0.0-...-535a2f3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2018 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const Pipe = '|'

Variables

View Source
var (
	ErrTooManyArgs = errors.New("too many args")
	ErrTooFewArgs  = errors.New("too few args")
)
View Source
var ArgBytes = argBytes{}
View Source
var ArgInt = argInt{}
View Source
var ArgStr = argStr{}
View Source
var (
	ErrInvalidSyntax = errors.New("invalid syntax")
)
View Source
var (
	ErrUnclosedBracket = errors.New("unclosed bracket")
)

Functions

func OriginalErr

func OriginalErr(err error) error

Types

type ArgFilter

type ArgFilter struct {
	Parser Parser
	Filter func(interface{}) (interface{}, error)
}

func (ArgFilter) Parse

func (a ArgFilter) Parse(str string) (res interface{}, n int, err error)

type ArgFn

type ArgFn map[string]Parser

func (ArgFn) Parse

func (a ArgFn) Parse(str string) (res interface{}, pos int, err error)

type ArgLambda

type ArgLambda struct {
	Args     Parser
	Run      RunFn
	Brackets Brackets
}

func (ArgLambda) Parse

func (a ArgLambda) Parse(str string) (res interface{}, pos int, err error)

type ArgOr

type ArgOr []Parser

func (ArgOr) Parse

func (args ArgOr) Parse(str string) (res interface{}, n int, err error)

type ArgPair

type ArgPair struct {
	Left  Parser
	Right Parser
	Run   func(_, _ interface{}) (interface{}, error)
}

func (ArgPair) Parse

func (arg ArgPair) Parse(str string) (res interface{}, pos int, err error)

type ArgPiped

type ArgPiped struct {
	Arg  Parser
	Nest Brackets
}

func (ArgPiped) Parse

func (arg ArgPiped) Parse(str string) (interface{}, int, error)

type ArgVariadic

type ArgVariadic struct {
	Arg Parser
}

func (ArgVariadic) Empty

func (ArgVariadic) Empty() (interface{}, error)

func (ArgVariadic) Parse

func (arg ArgVariadic) Parse(str string) (interface{}, int, error)

type Args

type Args []Parser

func (Args) Parse

func (args Args) Parse(str string) (res interface{}, pos int, err error)

type Brackets

type Brackets struct {
	Open, Close rune
}

type EmptyParser

type EmptyParser interface {
	Empty() (interface{}, error)
}

type ErrDetails

type ErrDetails struct {
	Err error
	Str string
	Pos int
}

func (ErrDetails) Error

func (e ErrDetails) Error() string

type Parser

type Parser interface {
	Parse(string) (interface{}, int, error)
}

type RunFn

type RunFn func([]interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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