commands

package
v2.2.0-preview1+incomp... Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2014 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "2.2.0-preview1"

Variables

View Source
var (
	NameRe          = "[\\w.][\\w.-]*"
	OwnerRe         = "[a-zA-Z0-9][a-zA-Z0-9-]*"
	NameWithOwnerRe = fmt.Sprintf("^(?:%s|%s\\/%s)$", NameRe, OwnerRe, NameRe)

	CmdRunner = NewRunner()
)

Functions

This section is empty.

Types

type Args

type Args struct {
	Executable string
	Command    string
	Params     []string

	Noop bool
	// contains filtered or unexported fields
}

func NewArgs

func NewArgs(args []string) *Args

func (*Args) After

func (a *Args) After(command ...string)

func (*Args) AppendParams

func (a *Args) AppendParams(params ...string)

func (*Args) Before

func (a *Args) Before(command ...string)

func (*Args) Commands

func (a *Args) Commands() []*cmd.Cmd

func (*Args) FirstParam

func (a *Args) FirstParam() string

func (*Args) GetParam

func (a *Args) GetParam(i int) string

func (*Args) HasFlags

func (a *Args) HasFlags(flags ...string) bool

func (*Args) HasSubcommand

func (a *Args) HasSubcommand() bool

func (*Args) IndexOfParam

func (a *Args) IndexOfParam(param string) int

func (*Args) InsertParam

func (a *Args) InsertParam(i int, items ...string)

func (*Args) IsParamsEmpty

func (a *Args) IsParamsEmpty() bool

func (*Args) LastParam

func (a *Args) LastParam() string

func (*Args) ParamsSize

func (a *Args) ParamsSize() int

func (*Args) PrependParams

func (a *Args) PrependParams(params ...string)

func (*Args) RemoveParam

func (a *Args) RemoveParam(i int) string

func (*Args) Replace

func (a *Args) Replace(executable, command string, params ...string)

func (*Args) ReplaceParam

func (a *Args) ReplaceParam(i int, item string)

func (*Args) ToCmd

func (a *Args) ToCmd() *cmd.Cmd

func (*Args) Words

func (a *Args) Words() []string

type Command

type Command struct {
	Run  func(cmd *Command, args *Args)
	Flag flag.FlagSet

	Key          string
	Usage        string
	Short        string
	Long         string
	GitExtension bool
	// contains filtered or unexported fields
}

func (*Command) Call

func (c *Command) Call(args *Args) (err error)

func (*Command) FormattedUsage

func (c *Command) FormattedUsage() string

func (*Command) List

func (c *Command) List() bool

func (*Command) Name

func (c *Command) Name() string

func (*Command) PrintUsage

func (c *Command) PrintUsage()

func (*Command) Runnable

func (c *Command) Runnable() bool

func (*Command) Use

func (c *Command) Use(subCommand *Command)

type ExecError

type ExecError struct {
	Err      error
	ExitCode int
}

func (*ExecError) Error

func (execError *ExecError) Error() string

type Runner

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

func NewRunner

func NewRunner() *Runner

func (*Runner) All

func (r *Runner) All() map[string]*Command

func (*Runner) Call

func (r *Runner) Call(cmd *Command, args *Args) ExecError

func (*Runner) Execute

func (r *Runner) Execute() ExecError

func (*Runner) Lookup

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

func (*Runner) Use

func (r *Runner) Use(command *Command)

type Updater

type Updater struct {
	Host           string
	CurrentVersion string
	// contains filtered or unexported fields
}

func NewUpdater

func NewUpdater() *Updater

func (*Updater) PromptForUpdate

func (updater *Updater) PromptForUpdate() (err error)

func (*Updater) Update

func (updater *Updater) Update() (err error)

Jump to

Keyboard shortcuts

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