Documentation
¶
Overview ¶
Package tui is sitrep's full-screen dashboard: tabs for a Watch view and a Top view, a detail pane, jumping to a session's terminal, and the queue and prune screens. It reads a snapshot from an Engine and changes state only by running the same fixed sitrep commands, after a confirm, through that Engine; --read-only turns every one of them off.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ThemeNames = []string{"default", "high-contrast", "mono"}
ThemeNames are the themes SITREP_THEME may name. "mono" uses no colours, only bold, faint and reverse.
Functions ¶
Types ¶
type Context ¶ added in v0.8.0
type Context struct {
UsedPercent float64 `json:"used_percent"`
Window int64 `json:"window"`
Tokens int64 `json:"tokens"`
At int64 `json:"at"`
Age int64 `json:"-"` // how long before the listing the status line last showed these numbers, worked out from the document's own time
}
Context is how full the context window of a session was at its last status line.
type Engine ¶
type Engine struct {
// Snapshot reads everything: all sessions, every queue item.
Snapshot func(ctx context.Context) (snapshot.Snapshot, error)
// Command runs one fixed sitrep command line (without the program name) and returns what it printed. An error carries its message.
Command func(ctx context.Context, args ...string) (string, error)
}
Engine is what the dashboard gets its data from and acts through.
type Options ¶
type Options struct {
Tab string // watch or top
Interval time.Duration
ReadOnly bool
NoBell bool
QuitOnJump bool
}
Options are the dashboard's settings.
type Session ¶
type Session struct {
ID string `json:"id"`
Short string `json:"short"`
Alias string `json:"alias"`
Dir string `json:"dir"`
Cwd string `json:"cwd"`
Running bool `json:"running"`
State string `json:"state"`
StateLabel string `json:"state_label"`
Age int64 `json:"age"`
StateChanged int64 `json:"state_changed"`
Idle bool `json:"idle"`
NeedsInput bool `json:"needs_input"`
Snoozed bool `json:"snoozed"`
QuietSecs *int64 `json:"quiet_secs"`
PID *int64 `json:"pid"`
Pinned bool `json:"pinned"`
Highlight bool `json:"highlight"`
Objective string `json:"objective"`
Progress string `json:"progress"`
Now string `json:"now"`
Queue Queue `json:"queue"`
Context *Context `json:"context"`
}
type Snapshot ¶
type Snapshot struct {
Version int `json:"version"`
Generated int64 `json:"generated"`
Registry string `json:"registry"`
Settings Settings `json:"settings"`
Inbox Queue `json:"inbox"`
Hidden Hidden `json:"hidden"`
Sessions []Session `json:"sessions"`
}
Snapshot is the document `sitrep ls --json -a` prints.
func FromSnapshot ¶
FromSnapshot makes the dashboard's own copy of a snapshot, cleaned again as everything it shows is.