args

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

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

Argument struct

func New

func New() *Args

Instantiate Args pointer

func (*Args) Alias

func (a *Args) Alias(long, short string, value interface{}) *Args

Define alias

func (*Args) Parse

func (a *Args) Parse(args []string) *Context

Parse args from supplied string slice

type Context

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

Parsed context struct

func NewContext

func NewContext(commands []string, options map[string]interface{}, defaults map[string]interface{}) *Context

Instantiate context pointer

func (*Context) At

func (c *Context) At(index int) string

Alias for StringAt

func (*Context) Bool

func (c *Context) Bool(name string) (value bool)

Get option as bool

func (*Context) Has

func (c *Context) Has(name string) (has bool)

Check option exintence

func (*Context) Int

func (c *Context) Int(name string) (value int)

Get option as int

func (*Context) IntAt

func (c *Context) IntAt(index int) int

Get subcommand at index as inttring

func (*Context) Len

func (c *Context) Len() int

Get subcommand size

func (*Context) String

func (c *Context) String(name string) (value string)

Get option as string

func (*Context) StringAt

func (c *Context) StringAt(index int) string

Get subcommand at index as string

func (*Context) Subcommands

func (c *Context) Subcommands() []string

Get all subcommands

Jump to

Keyboard shortcuts

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