Documentation ¶
Index ¶
- Constants
- Variables
- func GetErrorLevel(processState *os.ProcessState) (int, bool)
- func OurGetEnv(name string) (string, bool)
- func Parse(text string) ([][]*StatementT, error)
- type ArgsHookT
- type CommandNotFound
- type ErrorLevel
- type HookT
- type Interpreter
- func (this *Interpreter) Clone() (*Interpreter, error)
- func (this *Interpreter) Close()
- func (this *Interpreter) Interpret(text string) (errorlevel ErrorLevel, err error)
- func (this *Interpreter) SetStderr(f *os.File)
- func (this *Interpreter) SetStdin(f *os.File)
- func (this *Interpreter) SetStdout(f *os.File)
- func (this *Interpreter) Spawnvp() (ErrorLevel, error)
- type Redirecter
- type StatementT
Constants ¶
View Source
const ( CREATE_NEW_CONSOLE = 0x10 CREATE_NEW_PROCESS_GROUP = 0x200 )
from "TDM-GCC-64/x86_64-w64-mingw32/include/winbase.h"
View Source
const EMPTY_COMMAND_FOUND = "Empty command found"
View Source
const FLAG_AMP2NEWCONSOLE = false
View Source
const NOTQUOTED = '\000'
Variables ¶
View Source
var ErrorLevelStr string
View Source
var OnCommandNotFound = func(this *Interpreter, err error) error { err = &CommandNotFound{this.Args[0], err} return err }
View Source
var PercentFunc = map[string]func() string{ "CD": func() string { wd, err := os.Getwd() if err == nil { return wd } else { return "" } }, "ERRORLEVEL": func() string { return ErrorLevelStr }, }
Functions ¶
func GetErrorLevel ¶
func GetErrorLevel(processState *os.ProcessState) (int, bool)
func Parse ¶
func Parse(text string) ([][]*StatementT, error)
Types ¶
type ArgsHookT ¶
type ArgsHookT func(it *Interpreter, args []string) ([]string, error)
func SetArgsHook ¶
type CommandNotFound ¶
func (CommandNotFound) Error ¶
func (this CommandNotFound) Error() string
func (CommandNotFound) Stringer ¶
func (this CommandNotFound) Stringer() string
type ErrorLevel ¶
type ErrorLevel int
const ( NOERROR ErrorLevel = 0 THROUGH ErrorLevel = -1 SHUTDOWN ErrorLevel = -2 )
func (ErrorLevel) HasError ¶
func (this ErrorLevel) HasError() bool
func (ErrorLevel) HasValue ¶
func (this ErrorLevel) HasValue() bool
func (ErrorLevel) String ¶
func (this ErrorLevel) String() string
type HookT ¶
type HookT func(*Interpreter) (ErrorLevel, error)
type Interpreter ¶
type Interpreter struct { exec.Cmd Stdio [3]*os.File HookCount int Closer []io.Closer Tag interface{} PipeSeq [2]uint IsBackGround bool CloneHook func(*Interpreter) error CloseHook func(*Interpreter) }
func New ¶
func New() *Interpreter
func (*Interpreter) Clone ¶
func (this *Interpreter) Clone() (*Interpreter, error)
func (*Interpreter) Close ¶
func (this *Interpreter) Close()
func (*Interpreter) Interpret ¶
func (this *Interpreter) Interpret(text string) (errorlevel ErrorLevel, err error)
func (*Interpreter) SetStderr ¶
func (this *Interpreter) SetStderr(f *os.File)
func (*Interpreter) SetStdin ¶
func (this *Interpreter) SetStdin(f *os.File)
func (*Interpreter) SetStdout ¶
func (this *Interpreter) SetStdout(f *os.File)
func (*Interpreter) Spawnvp ¶
func (this *Interpreter) Spawnvp() (ErrorLevel, error)
type Redirecter ¶
type Redirecter struct {
// contains filtered or unexported fields
}
func NewRedirecter ¶
func NewRedirecter(no int) *Redirecter
func (*Redirecter) DupFrom ¶
func (this *Redirecter) DupFrom(fileno int)
func (*Redirecter) FileNo ¶
func (this *Redirecter) FileNo() int
func (*Redirecter) OpenOn ¶
func (this *Redirecter) OpenOn(cmd *Interpreter) (*os.File, error)
func (*Redirecter) SetAppend ¶
func (this *Redirecter) SetAppend()
func (*Redirecter) SetPath ¶
func (this *Redirecter) SetPath(path string)
type StatementT ¶
type StatementT struct { Args []string Redirect []*Redirecter Term string }
Click to show internal directories.
Click to hide internal directories.