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() sh.Obj
- func (appendfn *AppendFn) SetArgs(args []sh.Obj) 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() sh.Obj
- func (chdir *ChdirFn) SetArgs(args []sh.Obj) 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() sh.Obj
- func (c *Cmd) SetArgs(nodeArgs []sh.Obj) 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 Fns
- type LenFn
- func (lenfn *LenFn) ArgNames() []string
- func (lenfn *LenFn) Name() string
- func (lenfn *LenFn) Results() sh.Obj
- func (lenfn *LenFn) SetArgs(args []sh.Obj) 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 Shell
- func (shell *Shell) Environ() Env
- func (shell *Shell) Exec(path, content string) error
- func (shell *Shell) ExecFile(path string) error
- func (shell *Shell) ExecuteTree(tr *ast.Tree) (sh.Obj, error)
- func (shell *Shell) GetBuiltin(name string) (sh.Fn, bool)
- func (shell *Shell) GetFn(name string) (sh.Fn, bool)
- func (shell *Shell) Getbindfn(cmdName string) (sh.Fn, bool)
- func (shell *Shell) Getenv(name string) (sh.Obj, bool)
- func (shell *Shell) Getvar(name string) (sh.Obj, bool)
- func (shell *Shell) IsFn() bool
- func (shell *Shell) Name() string
- func (shell *Shell) Reset()
- func (shell *Shell) SetDebug(d bool)
- func (shell *Shell) SetEnviron(processEnv []string)
- func (shell *Shell) SetIsFn(b bool)
- func (shell *Shell) SetName(a string)
- func (shell *Shell) SetNashdPath(path string)
- func (shell *Shell) SetParent(a *Shell)
- func (shell *Shell) SetRepr(a string)
- func (shell *Shell) SetStderr(err io.Writer)
- func (shell *Shell) SetStdin(in io.Reader)
- func (shell *Shell) SetStdout(out io.Writer)
- func (shell *Shell) SetTree(t *ast.Tree)
- func (shell *Shell) Setbindfn(name string, value sh.Fn)
- func (shell *Shell) Setenv(name string, value sh.Obj)
- func (shell *Shell) Setvar(name string, value sh.Obj)
- func (shell *Shell) Stderr() io.Writer
- func (shell *Shell) Stdin() io.Reader
- func (shell *Shell) Stdout() io.Writer
- func (shell *Shell) String() string
- func (shell *Shell) Tree() *ast.Tree
- func (shell *Shell) TriggerCTRLC() error
- type SplitFn
- func (splitfn *SplitFn) ArgNames() []string
- func (splitfn *SplitFn) Name() string
- func (splitfn *SplitFn) Results() sh.Obj
- func (splitfn *SplitFn) SetArgs(args []sh.Obj) error
- func (splitfn *SplitFn) SetEnviron(env []string)
- func (splitfn *SplitFn) SetStderr(w io.Writer)
- func (splitfn *SplitFn) SetStdin(r io.Reader)
- func (splitfn *SplitFn) SetStdout(w io.Writer)
- func (splitfn *SplitFn) Start() error
- func (splitfn *SplitFn) Stderr() io.Writer
- func (splitfn *SplitFn) Stdin() io.Reader
- func (splitfn *SplitFn) Stdout() io.Writer
- func (splitfn *SplitFn) StdoutPipe() (io.ReadCloser, error)
- func (splitfn *SplitFn) String() string
- func (splitfn *SplitFn) Wait() error
- type StatusCode
- type UserFn
- type Var
Constants ¶
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) 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 Shell ¶
Shell is the core data structure.
func NewSubShell ¶
NewSubShell creates a nashell.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.
type SplitFn ¶ added in v0.2.1
type SplitFn struct {
// contains filtered or unexported fields
}
func (*SplitFn) StdoutPipe ¶ added in v0.2.1
func (splitfn *SplitFn) StdoutPipe() (io.ReadCloser, error)
Source Files
¶
- append.go
- chdir.go
- cmd.go
- fncall.go
- len.go
- log.go
- rfork_linux.go
- shell.go
- split.go
- util.go