Documentation ¶
Overview ¶
Package script allows the debugger to record and replay debugging scripts. In this package we refer to this as scribing and rescribing.
Scripts can of course be handwritten and be rescribed as though they had been scribed by the debugger. In this instance however, there is a risk that there will be errors - invalid commands will not be written to the script file by the Scribe type. On Rescribing, invalid commands will attempt to be replayed and the appropriate error message printed to the terminal. Comment lines begin with the # symbol.
Scripts can be run when scribing a new script. The action of running the script will be recorded in the new script.
The Rescribe type satisfies the terminal.Input and is used as a source for the debugger packages input loop.
Index ¶
- Variables
- type Rescribe
- type Scribe
- func (scr *Scribe) Commit() error
- func (scr *Scribe) EndPlayback() error
- func (scr *Scribe) EndSession() (rerr error)
- func (scr Scribe) IsActive() bool
- func (scr *Scribe) Rollback()
- func (scr *Scribe) StartPlayback() error
- func (scr *Scribe) StartSession(scriptfile string) error
- func (scr *Scribe) WriteInput(command string) error
Constants ¶
This section is empty.
Variables ¶
var ScriptEnd = errors.New("end of rescribe")
sentinal error returned when Rescribe.TermRead() reaches the expected end of the script.
Functions ¶
This section is empty.
Types ¶
type Rescribe ¶
type Rescribe struct {
// contains filtered or unexported fields
}
Rescribe represents an previously scribed script. The type implements the terminal.UserRead interface.
func RescribeScript ¶
RescribeScript is the preferred method of initialisation for the Rescribe type.
func (*Rescribe) IsInteractive ¶
IsInteractive implements the terminal.Input interface.
func (*Rescribe) IsRealTerminal ¶ added in v0.15.0
IsRealTerminal implements the terminal.Input interface.
func (*Rescribe) TermRead ¶
func (scr *Rescribe) TermRead(buffer []byte, _ terminal.Prompt, _ *terminal.ReadEvents) (int, error)
TermRead implements the terminal.Input interface.
func (*Rescribe) TermReadCheck ¶
TermReadCheck implements the terminal.Input interface.
type Scribe ¶
type Scribe struct {
// contains filtered or unexported fields
}
Scribe can be used again after a start()/end() cycle. isWriting() can be used to detect if a script is currently being captured but it is safe not to do because most functions silently fail if there is no current active session.
func (*Scribe) EndPlayback ¶
EndPlayback indicates that a replayed script has finished.
func (*Scribe) EndSession ¶
EndSession the current scribe session.
func (*Scribe) Rollback ¶
func (scr *Scribe) Rollback()
Rollback undoes calls to WriteInput() and WriteOutput since last Commit().
func (*Scribe) StartPlayback ¶
StartPlayback indicates that a replayed script has begun.
func (*Scribe) StartSession ¶
StartSession a new script.
func (*Scribe) WriteInput ¶
WriteInput writes user-input to the open script file.