Documentation
¶
Index ¶
Constants ¶
Variables ¶
var ErrDone = fmt.Errorf("commander is done and can't be started")
var ErrInProgress = fmt.Errorf("in progress")
Functions ¶
This section is empty.
Types ¶
type CommandTree ¶
type Commander ¶
type Commander interface { CommandTree }
func NewCommander ¶
NewCommander creates a commander object which can be started and stopped until shutdown is called, then it becomes noop.
The commander allows it to control multiple commands while taking orders from a higher level instance like a TUI.
TODO: Could be benficial for a TUI to directly control the commands.
That needs somehow blocking of a starting/stopping of the whole commander while a child is doing some work. This is currently not implemented. It is possible to control the underlying commands directly through `Subcommands()` but that could probably lead to nasty start/stop loops. ___________ ___________ ___________
| | Command() | | Command() | | | n*command | *-------1 | commander |1--------1 | tui | | | | | | | |___________| |___________| |___________|
type Control ¶
type Flag ¶
type Flag struct {
// contains filtered or unexported fields
}
flag symbols a busy process with the possibility to be called from multiple goroutines multiple times.
func (*Flag) InProgress ¶
InProgress aquires the flag if not set. Safe for parallel use. The caller is responsible to call done in case no error is returned.