Documentation
¶
Overview ¶
Package termfeatures provides safe, cross-platform terminal feature detection and operations for window title management.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDumbTerminal = errors.New("dumb terminal: no escape sequence support")
ErrDumbTerminal indicates the terminal doesn't support escape sequences.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct {
// Terminal identification
Term string // TERM environment variable
TermProgram string // TERM_PROGRAM environment variable
// Feature support
WindowTitle FeatureSupport
// Environment context
IsSSH bool
IsTmux bool
IsScreen bool
IsDumb bool
}
Capabilities describes the terminal's feature support.
type FeatureSupport ¶
type FeatureSupport int
FeatureSupport indicates the level of support for a terminal feature.
const ( // FeatureUnsupported indicates the feature is not supported. FeatureUnsupported FeatureSupport = iota // FeatureNative indicates the feature is supported via escape sequences. FeatureNative // FeatureUnknown indicates the feature may work but is not confirmed. FeatureUnknown )
func (FeatureSupport) String ¶
func (f FeatureSupport) String() string
String returns a string representation of FeatureSupport.
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
Terminal provides safe terminal operations with automatic capability detection.
func NewWithOutput ¶
NewWithOutput creates a new Terminal with the specified termenv output.
func (*Terminal) Capabilities ¶
func (t *Terminal) Capabilities() Capabilities
Capabilities returns the detected terminal capabilities.
func (*Terminal) ResetWindowTitle ¶
func (t *Terminal) ResetWindowTitle() TitleResult
ResetWindowTitle restores the default window title. Implementation varies by terminal; may be no-op on some terminals.
func (*Terminal) SetWindowTitle ¶
func (t *Terminal) SetWindowTitle(title string) TitleResult
SetWindowTitle sets the terminal window title. Safe to call even if unsupported (no-op).
func (*Terminal) SetWindowTitlef ¶
func (t *Terminal) SetWindowTitlef(format string, args ...any) TitleResult
SetWindowTitlef sets the title with fmt.Sprintf formatting.
func (*Terminal) SupportsWindowTitle ¶
SupportsWindowTitle returns true if the terminal supports window title setting.
type TitleResult ¶
TitleResult contains information about a window title operation.