Documentation
¶
Overview ¶
Package tui provides the terminal user interface for DevSec.
Index ¶
- func GetTerminalSize() (width, height int, err error)
- func IsTUIEnabled(progressFlag bool) bool
- func IsTerminal() bool
- func LogLevelStyle(level string) lipgloss.Style
- func Run(m Model) error
- func SeverityStyle(severity string) lipgloss.Style
- type CommandType
- type Config
- type KeyMap
- type LogEntry
- type Model
- func (m *Model) AddLog(level, message string)
- func (m *Model) AddStage(name string)
- func (m *Model) ElapsedTime() time.Duration
- func (m Model) Init() tea.Cmd
- func (m *Model) IsComplete() bool
- func (m *Model) Result() (any, error)
- func (m *Model) SetSize(width, height int)
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) UpdateStageStatus(name string, status progress.StageStatus, duration time.Duration)
- func (m Model) View() string
- type ProgressEventMsg
- type QuitMsg
- type Stage
- type Status
- type TickMsg
- type WindowSizeMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTerminalSize ¶
GetTerminalSize returns the current terminal dimensions.
func IsTUIEnabled ¶
IsTUIEnabled checks if TUI should be enabled based on environment.
func LogLevelStyle ¶
LogLevelStyle returns the appropriate style for a log level.
func SeverityStyle ¶
SeverityStyle returns the appropriate style for a severity level.
Types ¶
type CommandType ¶
type CommandType int
CommandType represents the type of command being executed.
const ( // CommandTypePipeline is for pipeline commands. CommandTypePipeline CommandType = iota // CommandTypeScan is for scan commands. CommandTypeScan // CommandTypeCompliance is for compliance commands. CommandTypeCompliance // CommandTypeML is for ML commands. CommandTypeML )
type Config ¶
type Config struct {
Events <-chan progress.Event
CommandName string
Stages []string
CommandType CommandType
}
Config holds configuration for creating a new Model.
type KeyMap ¶
type KeyMap struct {
Quit key.Binding
ScrollUp key.Binding
ScrollDown key.Binding
Help key.Binding
}
KeyMap defines the key bindings for the TUI.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the main bubbletea model for the TUI.
func (*Model) ElapsedTime ¶
ElapsedTime returns the elapsed time since start.
func (*Model) IsComplete ¶
IsComplete returns true if the operation has completed.
func (*Model) UpdateStageStatus ¶
UpdateStageStatus updates the status of a stage.
type ProgressEventMsg ¶
ProgressEventMsg wraps a progress event for the bubbletea message loop.
type Stage ¶
type Stage struct {
Name string
Status progress.StageStatus
Duration time.Duration
}
Stage represents a pipeline stage with its status.
type TickMsg ¶
type TickMsg struct{}
TickMsg is sent on each tick for updating elapsed time and spinners.
type WindowSizeMsg ¶
WindowSizeMsg is sent when the terminal window size changes.