Documentation
¶
Overview ¶
Package prompter is a small state machine for manipulating the terminal output during `bud run`.
The public methods must be called in the right order:
- Init
- Reloading
- SuccessReload or FailReload or NoReload
- Reloading
So the cursor can moves and clear lines properly. The behavior of the cursor across the different states looks like the following:
| Ready | Reloading | Ready Again | | :------------ | :------------------- | :------------ | | $ Ready on... | $ _Reloading... | $ Ready on... | | _ | (move cursor up) | _ |
TODO: find a better name for this package. Prompter sounds like it's reading user input from stdin, whereas this package is about managing `bud run` state and updating the terminal accordingly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Prompter ¶
type Prompter struct {
Counter int
// Prevent overriding stdout and stderr
StdOut bytes.Buffer
StdErr bytes.Buffer
// contains filtered or unexported fields
}
For prompting messages in the terminal
func (*Prompter) FailReload ¶
Prompt failed reloads. Reset counter.
func (Prompter) NoReload ¶
func (p Prompter) NoReload()
Don't change reload message currently in the terminal
func (*Prompter) SuccessReload ¶
func (p *Prompter) SuccessReload()
Prompt successful reloads including time (in ms) and total times in a row. Increase counter. Example: Ready on http://127.0.0.1:3000 in 264ms (x141)