Documentation
¶
Overview ¶
Package tui provides terminal-based UI for MindTrial CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInteractiveMode is returned when interactive mode encounters an error. ErrInteractiveMode = errors.New("interactive mode error") // ErrTerminalRequired is returned when interactive mode is attempted // in a non-terminal environment. ErrTerminalRequired = errors.New("interactive mode requires a terminal environment") )
Functions ¶
func IsTerminal ¶
func IsTerminal() bool
IsTerminal reports whether the current output is connected to a terminal.
Types ¶
type ConsoleBuffer ¶
ConsoleBuffer is a thread-safe buffer for storing console logs.
func (*ConsoleBuffer) String ¶
func (cb *ConsoleBuffer) String() string
String returns the accumulated string in a thread-safe manner.
type TaskMonitor ¶
type TaskMonitor struct {
// contains filtered or unexported fields
}
TaskMonitor represents an interactive terminal UI for monitoring task execution. It displays real-time progress, logs, and handles user input during task execution. It wraps a runners.Runner implementation to execute tasks while providing visual feedback.
func NewTaskMonitor ¶
func NewTaskMonitor(runner runners.Runner, console *ConsoleBuffer) *TaskMonitor
NewTaskMonitor initializes and returns a TaskMonitor. It accepts a pointer to a console buffer where an external logger writes during task execution. The TaskMonitor can read directly from this buffer to update the UI console component.
func (*TaskMonitor) Run ¶
func (t *TaskMonitor) Run(ctx context.Context, tasks []config.Task) (userAction UserInputEvent, result runners.AsyncResultSet, err error)
Run runs tasks in an interactive UI, displaying real-time progress and logs. It returns the user action and the run result set.
type UserInputEvent ¶
type UserInputEvent int
UserInputEvent represents the type of user actions in an interactive session.
const ( // Exit indicates that the user wants to exit the application. Exit UserInputEvent = iota // Quit indicates that the user wants to quit the current interactive screen while continuing execution. Quit // Continue indicates that the user wants to proceed with the current selections. Continue )
func DisplayRunConfigurationPicker ¶
func DisplayRunConfigurationPicker(providers []config.ProviderConfig) (UserInputEvent, error)
DisplayRunConfigurationPicker displays a terminal UI for enabling or disabling run configurations. It returns the selected user action and an error if the selection fails. This function modifies the providers slice directly.
func DisplayTaskPicker ¶
func DisplayTaskPicker(taskConfig *config.TaskConfig) (UserInputEvent, error)
DisplayTaskPicker displays a terminal UI for enabling or disabling tasks. It returns the selected user action and an error if the selection fails. This function modifies the provided taskConfig directly.