Documentation
¶
Overview ¶
nash provides the execution engine
Index ¶
- Constants
- type AppendFn
- func (appendfn *AppendFn) ArgNames() []string
- func (appendfn *AppendFn) Name() string
- func (appendfn *AppendFn) Results() *Obj
- func (appendfn *AppendFn) SetArgs(args []ast.Expr, envShell *Shell) error
- func (appendfn *AppendFn) SetEnviron(env []string)
- func (appendfn *AppendFn) SetStderr(w io.Writer)
- func (appendfn *AppendFn) SetStdin(r io.Reader)
- func (appendfn *AppendFn) SetStdout(w io.Writer)
- func (appendfn *AppendFn) Start() error
- func (appendfn *AppendFn) Stderr() io.Writer
- func (appendfn *AppendFn) Stdin() io.Reader
- func (appendfn *AppendFn) Stdout() io.Writer
- func (appendfn *AppendFn) StdoutPipe() (io.ReadCloser, error)
- func (appendfn *AppendFn) String() string
- func (appendfn *AppendFn) Wait() error
- type ChdirFn
- func (chdir *ChdirFn) ArgNames() []string
- func (chdir *ChdirFn) Name() string
- func (chdir *ChdirFn) Results() *Obj
- func (chdir *ChdirFn) SetArgs(args []ast.Expr, envShell *Shell) error
- func (chdir *ChdirFn) SetEnviron(env []string)
- func (chdir *ChdirFn) SetStderr(w io.Writer)
- func (chdir *ChdirFn) SetStdin(r io.Reader)
- func (chdir *ChdirFn) SetStdout(w io.Writer)
- func (chdir *ChdirFn) Start() error
- func (chdir *ChdirFn) Stderr() io.Writer
- func (chdir *ChdirFn) Stdin() io.Reader
- func (chdir *ChdirFn) Stdout() io.Writer
- func (chdir *ChdirFn) StdoutPipe() (io.ReadCloser, error)
- func (chdir *ChdirFn) String() string
- func (chdir *ChdirFn) Wait() error
- type Cmd
- func (c *Cmd) Args() []ast.Expr
- func (c *Cmd) Results() *Obj
- func (c *Cmd) SetArgs(nodeArgs []ast.Expr, envShell *Shell) error
- func (c *Cmd) SetEnviron(env []string)
- func (c *Cmd) SetStderr(err io.Writer)
- func (c *Cmd) SetStdin(in io.Reader)
- func (c *Cmd) SetStdout(out io.Writer)
- func (c *Cmd) Start() error
- func (c *Cmd) Stderr() io.Writer
- func (c *Cmd) Stdin() io.Reader
- func (c *Cmd) Stdout() io.Writer
- func (c *Cmd) Wait() error
- type Env
- type Fn
- type Fns
- type LenFn
- func (lenfn *LenFn) ArgNames() []string
- func (lenfn *LenFn) Name() string
- func (lenfn *LenFn) Results() *Obj
- func (lenfn *LenFn) SetArgs(args []ast.Expr, envShell *Shell) error
- func (lenfn *LenFn) SetEnviron(env []string)
- func (lenfn *LenFn) SetStderr(w io.Writer)
- func (lenfn *LenFn) SetStdin(r io.Reader)
- func (lenfn *LenFn) SetStdout(w io.Writer)
- func (lenfn *LenFn) Start() error
- func (lenfn *LenFn) Stderr() io.Writer
- func (lenfn *LenFn) Stdin() io.Reader
- func (lenfn *LenFn) Stdout() io.Writer
- func (lenfn *LenFn) StdoutPipe() (io.ReadCloser, error)
- func (lenfn *LenFn) String() string
- func (lenfn *LenFn) Wait() error
- type LogFn
- type Obj
- type Runner
- type Shell
- func (sh *Shell) Environ() Env
- func (sh *Shell) Exec(path, content string) error
- func (sh *Shell) ExecFile(path string) error
- func (sh *Shell) ExecuteTree(tr *ast.Tree) (*Obj, error)
- func (sh *Shell) GetBuiltin(name string) (Fn, bool)
- func (sh *Shell) GetFn(name string) (Fn, bool)
- func (sh *Shell) GetVar(name string) (*Obj, bool)
- func (sh *Shell) Getbindfn(cmdName string) (Fn, bool)
- func (sh *Shell) Getenv(name string) (*Obj, bool)
- func (sh *Shell) IsFn() bool
- func (sh *Shell) Name() string
- func (sh *Shell) Reset()
- func (sh *Shell) SetDebug(d bool)
- func (sh *Shell) SetEnviron(processEnv []string)
- func (sh *Shell) SetIsFn(b bool)
- func (sh *Shell) SetName(a string)
- func (sh *Shell) SetNashdPath(path string)
- func (sh *Shell) SetParent(a *Shell)
- func (sh *Shell) SetRepr(a string)
- func (sh *Shell) SetStderr(err io.Writer)
- func (sh *Shell) SetStdin(in io.Reader)
- func (sh *Shell) SetStdout(out io.Writer)
- func (sh *Shell) SetTree(t *ast.Tree)
- func (sh *Shell) Setbindfn(name string, value Fn)
- func (sh *Shell) Setenv(name string, value *Obj)
- func (sh *Shell) Setvar(name string, value *Obj)
- func (sh *Shell) Stderr() io.Writer
- func (sh *Shell) Stdin() io.Reader
- func (sh *Shell) Stdout() io.Writer
- func (sh *Shell) String() string
- func (sh *Shell) Tree() *ast.Tree
- func (sh *Shell) TriggerCTRLC() error
- type StatusCode
- type UserFn
- type Var
Constants ¶
const ( StringType objType = iota + 1 FnType ListType )
const ( ESuccess StatusCode = 0 ENotFound = 127 ENotStarted = 255 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppendFn ¶
type AppendFn struct {
// contains filtered or unexported fields
}
func (*AppendFn) SetArgs ¶
func (*AppendFn) StdoutPipe ¶
func (appendfn *AppendFn) StdoutPipe() (io.ReadCloser, error)
type ChdirFn ¶
type ChdirFn struct {
// contains filtered or unexported fields
}
func (*ChdirFn) StdoutPipe ¶
func (chdir *ChdirFn) StdoutPipe() (io.ReadCloser, error)
type Cmd ¶
Cmd is a nash command. It has maps of input and output file descriptors that can be set by SetInputfd and SetOutputfd. This can be used to pipe execution of Cmd commands.
type LenFn ¶
type LenFn struct {
// contains filtered or unexported fields
}
func (*LenFn) StdoutPipe ¶
func (lenfn *LenFn) StdoutPipe() (io.ReadCloser, error)
type Obj ¶
type Obj struct {
// contains filtered or unexported fields
}
func (Obj) Type ¶
func (o Obj) Type() objType
type Runner ¶
type Shell ¶
Shell is the core data structure.
func NewSubShell ¶
NewSubShell creates a nash.Shell that inherits the parent shell stdin, stdout, stderr and mutex lock. Every variable and function lookup is done first in the subshell and then, if not found, in the parent shell recursively.
func (*Shell) Exec ¶
Exec executes the commands specified by string content
func (*Shell) ExecFile ¶
Execute the nash file at given path
func (*Shell) SetDebug ¶
SetDebug enable/disable debug in the shell
func (*Shell) SetNashdPath ¶
SetNashdPath sets an alternativa path to nashd
func (*Shell) SetRepr ¶
SetRepr set the string representation of the shell
func (*Shell) SetStderr ¶
SetStderr sets stderr for commands
func (*Shell) SetStdin ¶
SetStdin sets the stdin for commands
func (*Shell) SetStdout ¶
SetStdout sets stdout for commands
func (*Shell) SetTree ¶
SetTree sets the internal tree of the interpreter. It's used for sub-shells like `fn`.
func (*Shell) Tree ¶
Tree returns the internal tree of the subshell.
Source Files
¶
- append.go
- chdir.go
- cmd.go
- fncall.go
- len.go
- log.go
- obj.go
- objtype_string.go
- rfork_linux.go
- shell.go
- util.go