Documentation ¶
Index ¶
- Constants
- type Gosh
- func (g *Gosh) Close()
- func (g *Gosh) DebugMessage(k int, msg string)
- func (g *Gosh) Eval(line string)
- func (g *Gosh) GetWD() string
- func (g *Gosh) Init() error
- func (g *Gosh) Interactive() (int, error)
- func (g *Gosh) LoadPlugin(s string) error
- func (g *Gosh) SendKey(k *termios.Key) bool
- func (g *Gosh) SetDebugClient(c *debug.Client)
- func (g *Gosh) Write(p []byte) (int, error)
- func (g *Gosh) WriteString(s string) (int, error)
- type Handler
- type Prompt
- type PromptStyle
- type SimplePromptStyle
Constants ¶
const GoshLicense = `` /* 1082-byte string literal not displayed */
GoshLicense contains basic information about this shell's license. It defaults to the MIT license.
const GoshName = "gosh"
GoshName is the shells name, defaulting to "gosh"
const GoshVersion = "v0.0.1"
GoshVersion is the gosh's rolling version number The GoshVersion number should be equal to the tag version in the Git repository
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gosh ¶
type Gosh struct {
// contains filtered or unexported fields
}
Gosh type collects all modules of a gosh shell.
func (*Gosh) Close ¶
func (g *Gosh) Close()
Close closes all sub-parts of the gosh instance (I/O, the terminal).
func (*Gosh) DebugMessage ¶
DebugMessage sends a message with the specified module identifier and contents to the debug server.
func (*Gosh) GetWD ¶
GetWD returns a string representation of the current working directory or ~ if any error occured (e. g. the directory was deleted).
func (*Gosh) Init ¶
Init prepares all sub-functionality of this gosh instance. If the returned error is not nil, this gosh must not be used until the issue is fixed.
func (*Gosh) Interactive ¶
Interactive sets this gosh's mode to interactive. User input is read from the underlying terminal and commands are executed in the current namespace. A suitable exit code and any error is returned in the end.
func (*Gosh) LoadPlugin ¶
LoadPlugin loads the plugin specified by the path. It returns an error if the file could not be read.
func (*Gosh) SetDebugClient ¶
SetDebugClient attaches the specified debugging client to the gosh instance.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles all event-based plugins. It is capable of loading new plugins from a specified path using the Load() method, as well as sending an event to all registered plugins
func NewHandler ¶
NewHandler creates a new plugin handler with 0 plugins pre-loaded and the specified gosh as parent. g shall not be nil.
type Prompt ¶
type Prompt struct {
// contains filtered or unexported fields
}
Prompt is responsible for drawing the UI of an interactive Gosh
type PromptStyle ¶
type PromptStyle interface { // LeftPrompt returns the contents of the area to the left of the prompt. // The int parameter indicates which prompt line is requested (starting with 0). // All paddings and margins must be added inside the prompt style, as the style will // be printed as-is and with no added spaces. LeftPrompt(*Gosh, int) string // RightPrompt returns the contents of the area on the right side of the screen. // The contents should be returned from left to right RightPrompt(*Gosh, int) string }
PromptStyle are individual styles for the prompt. They create prompt text to the left and right.
type SimplePromptStyle ¶
type SimplePromptStyle struct{}
SimplePromptStyle is a prompt style that displays the most basic contents
func (*SimplePromptStyle) LeftPrompt ¶
func (s *SimplePromptStyle) LeftPrompt(g *Gosh, line int) string
LeftPrompt displays the current working directory and an >
func (*SimplePromptStyle) RightPrompt ¶
func (s *SimplePromptStyle) RightPrompt(g *Gosh, line int) string
RightPrompt simply displays a bar