shell

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 13 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) GetIntFlagValue added in v0.3.0

func (c *Context) GetIntFlagValue(flag string) int64

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(path 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

func (Executors) GetSuggests added in v0.4.0

func (e Executors) GetSuggests(commands string) []prompt.Suggest

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) ImprovedShell added in v0.4.0

func (s *Shell) ImprovedShell()

func (*Shell) OldShell added in v0.4.0

func (s *Shell) OldShell()

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