commander

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Usage

func Usage() error

Types

type Arg

type Arg struct {
	Name string
	// contains filtered or unexported fields
}

func (*Arg) Custom added in v0.1.5

func (a *Arg) Custom(fn func(string) error) *Custom

Custom allows you to define a custom parsing function

func (*Arg) Int

func (a *Arg) Int(target *int) *Int

func (*Arg) String

func (a *Arg) String(target *string) *String

func (*Arg) StringMap

func (a *Arg) StringMap(target *map[string]string) *StringMap

type Args

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

func (*Args) Strings

func (a *Args) Strings(target *[]string) *Strings

type Bool

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

func (*Bool) Default

func (v *Bool) Default(value bool)

func (*Bool) Optional

func (v *Bool) Optional()

type CLI

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

func New

func New(name string) *CLI

func (*CLI) Arg

func (c *CLI) Arg(name string) *Arg

func (*CLI) Args

func (c *CLI) Args(name string) *Args

func (*CLI) Command

func (c *CLI) Command(name, usage string) Command

func (*CLI) Flag

func (c *CLI) Flag(name, usage string) *Flag

func (*CLI) Parse

func (c *CLI) Parse(ctx context.Context, args []string) error

func (*CLI) Run

func (c *CLI) Run(runner func(ctx context.Context) error)

func (*CLI) Template

func (c *CLI) Template(template *template.Template)

func (*CLI) Trap

func (c *CLI) Trap(signals ...os.Signal)

func (*CLI) Version

func (c *CLI) Version(version string) *CLI

func (*CLI) Writer

func (c *CLI) Writer(writer io.Writer) *CLI

type Command

type Command interface {
	Command(name, usage string) Command
	Flag(name, usage string) *Flag
	Arg(name string) *Arg
	Args(name string) *Args
	Run(runner func(ctx context.Context) error)
}

type Custom added in v0.1.5

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

func (*Custom) Default added in v0.1.5

func (v *Custom) Default(value string)

func (*Custom) Optional added in v0.1.5

func (v *Custom) Optional()

type Flag

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

func (*Flag) Bool

func (f *Flag) Bool(target *bool) *Bool

func (*Flag) Custom added in v0.1.5

func (f *Flag) Custom(fn func(string) error) *Custom

Custom allows you to define a custom parsing function

func (*Flag) Int

func (f *Flag) Int(target *int) *Int

func (*Flag) Short

func (f *Flag) Short(short byte) *Flag

func (*Flag) String

func (f *Flag) String(target *string) *String

func (*Flag) StringMap

func (f *Flag) StringMap(target *map[string]string) *StringMap

func (*Flag) Strings

func (f *Flag) Strings(target *[]string) *Strings

type Int

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

func (*Int) Default

func (v *Int) Default(value int)

func (*Int) Optional

func (v *Int) Optional()

type String

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

func (*String) Default

func (v *String) Default(value string)

func (*String) Optional

func (v *String) Optional()

type StringMap

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

func (*StringMap) Default

func (v *StringMap) Default(value map[string]string)

func (*StringMap) Optional

func (v *StringMap) Optional()

type Strings

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

func (*Strings) Default

func (v *Strings) Default(values ...string)

func (*Strings) Optional

func (v *Strings) Optional()

type Subcommand added in v0.1.8

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

func (*Subcommand) Arg added in v0.1.8

func (c *Subcommand) Arg(name string) *Arg

func (*Subcommand) Args added in v0.1.8

func (c *Subcommand) Args(name string) *Args

func (*Subcommand) Command added in v0.1.8

func (c *Subcommand) Command(name, usage string) Command

func (*Subcommand) Flag added in v0.1.8

func (c *Subcommand) Flag(name, usage string) *Flag

func (*Subcommand) Run added in v0.1.8

func (c *Subcommand) Run(runner func(ctx context.Context) error)

Jump to

Keyboard shortcuts

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