shell

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Args  []string
	Flags *flags.Flags

	Exec *Executor
}

func (*Context) ContainsFlag

func (c *Context) ContainsFlag(flag string) bool

func (*Context) Error

func (c *Context) Error(err error)

func (*Context) GetFlagValue

func (c *Context) GetFlagValue(flag string) string

func (*Context) ShowHelpPage

func (c *Context) ShowHelpPage()

func (*Context) ValidateFile

func (c *Context) ValidateFile(flag string) (*os.File, error)

func (*Context) ValidateFilePath

func (c *Context) ValidateFilePath(filepath string) (*os.File, error)

type Executor

type Executor struct {
	Name string
	Help string

	Aliases []string

	WithValue bool

	Flags     *flags.Flags
	CountArgs int

	SubExecs Executors

	Func func(*Context)
}

func (*Executor) AddExecutor

func (e *Executor) AddExecutor(exec *Executor)

func (*Executor) Execute

func (e *Executor) Execute(ctx *Context)

func (*Executor) HelpPage

func (e *Executor) HelpPage(level int) string

type Executors

type Executors map[string]*Executor

type Shell

type Shell struct {
	Execs Executors

	Active bool
}

func NewShell

func NewShell() *Shell

func (*Shell) AddExecutor

func (s *Shell) AddExecutor(exec *Executor)

func (*Shell) Error

func (s *Shell) Error(msg string)

func (*Shell) GetExecutor added in v0.1.0

func (s *Shell) GetExecutor(name string) (*Executor, bool)

func (*Shell) Run

func (s *Shell) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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