cmdoptions

package
v0.0.0-...-44cae35 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptionTypeBool    = "b"
	OptionTypeDecimal = "d"
	OptionTypeString  = "s"
)

Variables

View Source
var (
	ErrOptionNotSet       = errors.New("option not set")
	ErrOptionInvalidValue = errors.New("option value invalid")
	ErrOptionInvalidType  = errors.New("option type invalid")
	ErrOptionParseValue   = errors.New("option parse value error")
)

Functions

This section is empty.

Types

type CmdOptions

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

func NewCmdOptions

func NewCmdOptions() CmdOptions

func (*CmdOptions) GetBool

func (co *CmdOptions) GetBool(optionName string) (bool, error)

func (*CmdOptions) GetDecimal

func (co *CmdOptions) GetDecimal(optionName string) (int, error)

func (*CmdOptions) GetString

func (co *CmdOptions) GetString(optionName string) (string, error)

func (*CmdOptions) GetStringArray

func (co *CmdOptions) GetStringArray(optionName string) []string

func (*CmdOptions) Parse

func (co *CmdOptions) Parse(format string, options string) error

"l:b,p:d,d:s", "-l -p 8080 -d /usrs/wenjing"

func (*CmdOptions) SetOption

func (co *CmdOptions) SetOption(optName string, optType string, defaultValue interface{})

Jump to

Keyboard shortcuts

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