lalash

package module
v0.0.0-...-d8d80a5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 19 Imported by: 0

README

lalash

A toy shell

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalString

func EvalString(ctx context.Context, cmd Command, expr string) error

func Exec

func Exec(ctx context.Context, cmd Command, argv []string) error

func RunCommand

func RunCommand(expr string) int

func RunREPL

func RunREPL() int

func RunScript

func RunScript(script io.Reader) int

func RunScriptFile

func RunScriptFile(filename string) int

Types

type Command

type Command struct {
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	ExtraFiles []*os.File
	Internal   Internal
}

type Internal

type Internal struct {
	Cmds         *sync.Map
	Alias        *sync.Map
	MutVar       *sync.Map
	Var          *sync.Map
	GlobalMutVar *sync.Map
	GlobalVar    *sync.Map
	Args         *sync.Map
	Return       *sync.Map
}

func NewInternal

func NewInternal() Internal

func (Internal) Get

func (i Internal) Get(key string) (InternalCmd, error)

func (Internal) GetAlias

func (i Internal) GetAlias(args string) string

func (Internal) GetAliasAll

func (i Internal) GetAliasAll() []string

func (Internal) GetCmdsAll

func (i Internal) GetCmdsAll() []string

func (Internal) SetInternalCmd

func (in Internal) SetInternalCmd(name string, cmd InternalCmd)

type InternalCmd

type InternalCmd struct {
	Usage string
	Fn    func(context.Context, Command, string, ...string) error
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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