Documentation
¶
Index ¶
- type CommandLine
- func (c *CommandLine) DumpErrors() (isNotNilArray error)
- func (c *CommandLine) GetInput() string
- func (c *CommandLine) GetPsString() string
- func (c *CommandLine) Parse() (err error)
- func (c *CommandLine) Refresh()
- func (c *CommandLine) Run() error
- func (c *CommandLine) SetDebug(flag bool)
- func (c *CommandLine) SetInput(input string)
- func (c *CommandLine) TerminateLine(withPsString ...bool) (err error)
- type Pipe
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandLine ¶
type CommandLine struct {
Debug bool
// contains filtered or unexported fields
}
CommandLine is the main struct for giosh shell instance. This struct has any internal state of a shell such as lexical scopes, expressions for the evaluation, pipes which internal I/O are processed, etc.
func (*CommandLine) DumpErrors ¶
func (c *CommandLine) DumpErrors() (isNotNilArray error)
DumpErrors is error reporting function for CommandLine. It scans any error object in CommandLine.error array and returns bool if it contains not a nil value
func (*CommandLine) GetInput ¶
func (c *CommandLine) GetInput() string
GetInput get raw input string from c.input. (just for temporary caching for file reading)
func (*CommandLine) GetPsString ¶
func (c *CommandLine) GetPsString() string
GetPsString returns PS shell description for bufio.Writer
func (*CommandLine) Parse ¶
func (c *CommandLine) Parse() (err error)
Parse parses giosh command line and return output string. At now, any lexical scopes are separated with "|" and any lines are separated with EOF. (multi-line is not allowed)
func (*CommandLine) Refresh ¶
func (c *CommandLine) Refresh()
Refresh clears basic properties for each evaluation of lexicalScopes. For bufio.Scanner, this methods clears properties related to every registered recognized lexicalScopes at the head of Parse.
func (*CommandLine) Run ¶
func (c *CommandLine) Run() error
Run is the entry point for giosh shell interface.
If you simply run it without any additional reader/writer sets, the vm starts with default I/O interface (bufio.Scanner and os.Stdout).
func (*CommandLine) SetDebug ¶
func (c *CommandLine) SetDebug(flag bool)
SetDebug is write-only setter method for CommandLine.Debug flag.
func (*CommandLine) SetInput ¶
func (c *CommandLine) SetInput(input string)
SetInput sets raw input string for c.input. (for reading scripts from arguments)
func (*CommandLine) TerminateLine ¶
func (c *CommandLine) TerminateLine(withPsString ...bool) (err error)
TerminateLine makes line termination with printing or not printing PS string Also any errors recorded in error stack will be shown by this method. FIXME: return value maybe not necessary, plan to remove it. Historically this method have a return value with error type. This is for DumpError, which have returned error object in old code