command

package
v0.0.0-...-0b835a5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Run  func(c *Command, r *Runtime)
	Flag flag.FlagSet

	Name  string
	Usage string
	Long  string

	Aliases []string
}

func (*Command) Call

func (c *Command) Call(r *Runtime) (err error)

func (*Command) UsageText

func (c *Command) UsageText() string

type Runner

type Runner struct {
	Commands map[string]*Command
	Aliases  map[string]string
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner() *Runner

func (*Runner) Alias

func (r *Runner) Alias(from string, to ...string)

func (Runner) Command

func (r Runner) Command(name string) *Command

func (*Runner) DefaultCommand

func (r *Runner) DefaultCommand() *Command

func (*Runner) Execute

func (r *Runner) Execute()

func (*Runner) HelpCommand

func (r *Runner) HelpCommand() *Command

func (*Runner) Register

func (r *Runner) Register(c *Command)

func (*Runner) RegisterDefault

func (r *Runner) RegisterDefault(c *Command)

func (*Runner) RegisterHelp

func (r *Runner) RegisterHelp(c *Command)

func (*Runner) SortedCommands

func (r *Runner) SortedCommands() []Command

type Runtime

type Runtime struct {
	Executable string
	Command    string
	Args       []string
}

func NewRuntime

func NewRuntime(args []string) *Runtime

Jump to

Keyboard shortcuts

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