argparse

package
v0.0.0-...-a4c085a Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2015 License: GPL-2.0, GPL-3.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArgList = make(map[string]Arg)

Functions

func EvalArgs

func EvalArgs(args []string) []string

func EvalDefaultArgs

func EvalDefaultArgs() []string

func HandleArg

func HandleArg(argname string, value string)

func RegisterArg

func RegisterArg(argname string, value Value, defValue interface{}, help string, booleanArg bool)

func SetBasename

func SetBasename(s string)

func Usage

func Usage(error int)

Types

type Arg

type Arg struct {
	Name     string
	Usage    string
	Value    *Value
	DefValue interface{}
	Required bool
	IsBool   bool
}

func (Arg) Len

func (a Arg) Len() int

func (Arg) Pretty

func (a Arg) Pretty() string

type BoolValue

type BoolValue struct {
	Value bool
	// contains filtered or unexported fields
}

func RegisterBool

func RegisterBool(argname string, defValue bool, help string) *BoolValue

func (*BoolValue) Get

func (b *BoolValue) Get() bool

func (*BoolValue) IsSet

func (b *BoolValue) IsSet() bool

func (*BoolValue) Parse

func (b *BoolValue) Parse(value string) error

func (*BoolValue) String

func (b *BoolValue) String() string

type IntValue

type IntValue struct {
	Value int
	// contains filtered or unexported fields
}

func RegisterInt

func RegisterInt(argname string, defValue int, help string) *IntValue

func (*IntValue) Get

func (i *IntValue) Get() int

func (*IntValue) IsSet

func (i *IntValue) IsSet() bool

func (*IntValue) Parse

func (i *IntValue) Parse(value string) error

func (*IntValue) String

func (i *IntValue) String() string

type StringValue

type StringValue struct {
	Value string
	// contains filtered or unexported fields
}

func RegisterString

func RegisterString(argname string, defValue string, help string) *StringValue

func (*StringValue) Get

func (s *StringValue) Get() string

func (*StringValue) IsSet

func (s *StringValue) IsSet() bool

func (*StringValue) Parse

func (s *StringValue) Parse(value string) error

func (*StringValue) String

func (s *StringValue) String() string

type Value

type Value interface {
	String() string
	Parse(string) error
	IsSet() bool
}

Jump to

Keyboard shortcuts

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