flag

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParamsNotEnough     = errors.New("params not enough")
	ErrTooMuchParams       = errors.New("too much params")
	ErrUnsupportedFlagType = errors.New("unsupported flag type")
	ErrUnsupportedArgType  = errors.New("unsupported argument type")
)
View Source
var (
	ErrMethodNotFound         = errors.New("method not found")
	ErrInvalidMethodPrototype = errors.New("invalid method prototype: method input argument count != 2")
)

Functions

func Exec

func Exec(v reflect.Value, cmd []string) (out []reflect.Value, err error)

func ExecMethod

func ExecMethod(
	ctx Context, method, methodCtx reflect.Value, cmd []string) (out []reflect.Value, err error)

func Help

func Help(app string, v reflect.Value)

func HelpCmd

func HelpCmd(app string, v reflect.Value, cmd string)

func HelpMethod

func HelpMethod(app string, method reflect.Value)

func Parse

func Parse(
	ctx Context, argsType reflect.Type, cmd []string) (args reflect.Value, err error)

Types

type Cmd

type Cmd struct{}

type Context

type Context interface {
	Subst(vexp interface{}, ft int) (vres interface{}, err error)
	SubstText(exprvar string, ft int) (v string, err error)
}

Jump to

Keyboard shortcuts

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