Gim/internal/core/command.go
Hayden Hargreaves 10e37b82af
All checks were successful
Run Test Suite / test (push) Successful in 13s
feat: implemented the command window! Not tested. Maybe we need some?
2026-03-14 23:13:59 -07:00

40 lines
808 B
Go

package core
import "strings"
const CommandOutputExitMessage = "Press ENTER to continue"
type CommandOutput struct {
Title string
Lines []string
ScrollOffset int // Not implemented yet
// Height is computing via lines and title
Inline bool // Show inline instead of the window
IsError bool
}
// CommandOutput.Height: Compute the height (in lines) based on the line count, and title.
func (c *CommandOutput) Height() int {
if c.Inline {
return 1
}
var h int
h += len(c.Lines)
if strings.TrimSpace(c.Title) != "" {
h++
}
// Padding:
// +1 for 'enter key...' message
// +1 for top bar (border)
h += 2
return h
}
// CommandOutput.IsActive: Is the command output in a state that should be displayed.
func (c *CommandOutput) IsActive() bool {
return len(c.Lines) > 0
}