Documentation
¶
Index ¶
- Constants
- Variables
- func ParseLine(line string) (args []string, err error)
- type Command
- type CommandFunc
- type Shell
- func (s *Shell) AddHistory(line string)
- func (s *Shell) ClearHistory()
- func (s *Shell) Command(name string, desc string, fx CommandFunc)
- func (s *Shell) CommandOneArg(name string, desc string, fx CommandFunc)
- func (s *Shell) DelHistory(n int)
- func (s *Shell) ExecuteLine(line string) (err error)
- func (s *Shell) GetHistory() (h []string)
- func (s *Shell) Help(args []string) error
- func (s *Shell) HexDump(buf []byte)
- func (s *Shell) History(args []string) error
- func (s *Shell) LoadHistory(filename string) (err error)
- func (s *Shell) Print(v ...interface{})
- func (s *Shell) Printf(format string, v ...interface{})
- func (s *Shell) Println(v ...interface{})
- func (s *Shell) Run()
- func (s *Shell) SaveHistory(filename string) (err error)
- func (s *Shell) SearchHistory(match string) (line string)
- func (s *Shell) SetEcho(echo bool)
- func (s *Shell) SetFlags(name string, flags int) error
- func (s *Shell) SetIO(r io.Reader, w io.Writer)
- func (s *Shell) SetPrompt(prompt string)
- func (s *Shell) Terminate()
Constants ¶
View Source
const ( VT100_UP = 65 VT100_DOWN = 66 VT100_RIGHT = 67 VT100_LEFT = 68 ASCII_TAB = 0x09 ASCII_CTRLC = 0x03 ASCII_CTRLD = 0x04 ASCII_BEL = 0x07 ASCII_BS = 0x08 ASCII_CR = 0x0D ASCII_LF = 0x0A ASCII_ESC = 0x1B ASCII_DEL = 0x7F FlagHide = 1 << 0 FlagNoargs = 1 << 1 FlagAlias = 1 << 2 )
Variables ¶
View Source
var ErrNoSuchCommand = errors.New("no such command")
Functions ¶
Types ¶
type CommandFunc ¶
type Shell ¶
func (*Shell) AddHistory ¶ added in v1.4.0
AddHistory adds a line to the history
func (*Shell) ClearHistory ¶ added in v1.4.0
func (s *Shell) ClearHistory()
func (*Shell) CommandOneArg ¶ added in v1.3.0
func (s *Shell) CommandOneArg(name string, desc string, fx CommandFunc)
func (*Shell) DelHistory ¶ added in v1.4.0
DelHistory removes the last n lines from the history
func (*Shell) ExecuteLine ¶ added in v1.2.0
func (*Shell) GetHistory ¶ added in v1.4.0
GetHistory returns a copy of the history
func (*Shell) LoadHistory ¶ added in v1.4.0
func (*Shell) Print ¶
func (s *Shell) Print(v ...interface{})
Print sends output to the configured io.Writer Arguments are handled in the manner of fmt.Print.
func (*Shell) Printf ¶
Printf sends output to the configured io.Writer Arguments are handled in the manner of fmt.Printf.
func (*Shell) Println ¶
func (s *Shell) Println(v ...interface{})
Println sends output to the configured io.Writer Arguments are handled in the manner of fmt.Println.
func (*Shell) Run ¶
func (s *Shell) Run()
Run reads and writes from the io streams generating the command prompt and executing commands.
func (*Shell) SaveHistory ¶ added in v1.4.0
func (*Shell) SearchHistory ¶ added in v1.4.0
func (*Shell) SetIO ¶
SetIO assigns input and output sources. They should conform to the io.Reader and io.Writer interface. The io.Reader should block until a characters are ready.
Click to show internal directories.
Click to hide internal directories.