Documentation
¶
Index ¶
- func FormatNotification(notification *pb.Notification, notificationType string) string
- func MakeSessionIDHyperlink(sessionID string, enableHyperlinks bool) string
- func MakeTabIDHyperlink(tabID string, enableHyperlinks bool) string
- func MakeWindowIDHyperlink(windowID string, enableHyperlinks bool) string
- func OSC8Hyperlink(url, text string) string
- func PrintJSON(v interface{}) error
- func PrintYAML(v interface{}) error
- func SessionActivateURL(sessionID string) string
- func SupportsOSC8() bool
- func TabActivateURL(tabID string) string
- func WindowActivateURL(windowID string) string
- type Annotation
- type Formatter
- func (f *Formatter) FormatAlertResponse(response interface{}) error
- func (f *Formatter) FormatAnnotations(annotations []*Annotation) error
- func (f *Formatter) FormatBroadcastDomains(domains []*client.BroadcastDomain) error
- func (f *Formatter) FormatBuffer(resp *pb.GetBufferResponse) error
- func (f *Formatter) FormatBufferEscaped(resp *pb.GetBufferResponse, includeColors bool) error
- func (f *Formatter) FormatBufferWithColors(resp *pb.GetBufferResponse) error
- func (f *Formatter) FormatClientWindows(windows []*client.WindowInfo) error
- func (f *Formatter) FormatCursor(cursor *pb.Coord) error
- func (f *Formatter) FormatCustomControlResponse(response interface{}) error
- func (f *Formatter) FormatFilePanelResponse(response interface{}) error
- func (f *Formatter) FormatFindResults(results []*client.FindResult, showLineNumbers bool) error
- func (f *Formatter) FormatGeneric(v interface{}) error
- func (f *Formatter) FormatHighlightResults(results []*client.HighlightResult) error
- func (f *Formatter) FormatKeyBindings(bindings []interface{}) error
- func (f *Formatter) FormatLifecycleResponse(response interface{}) error
- func (f *Formatter) FormatReplaceResults(results []*client.ReplaceResult) error
- func (f *Formatter) FormatSelection(selection *pb.Selection) error
- func (f *Formatter) FormatSessions(sessions []*client.SessionInfo) error
- func (f *Formatter) FormatSessionsWithRawTree(listResp *pb.ListSessionsResponse, sessions []*client.SessionInfo) error
- func (f *Formatter) FormatStringList(title string, items []string) error
- func (f *Formatter) FormatTabInfo(tab *TabInfo) error
- func (f *Formatter) FormatTabResponse(resp *pb.CreateTabResponse) error
- func (f *Formatter) FormatTable(data *TableData) error
- func (f *Formatter) FormatTabs(tabs []*TabInfo) error
- func (f *Formatter) FormatTmuxConnections(connections []*client.TmuxConnection) error
- func (f *Formatter) FormatTriggers(triggers []*Trigger) error
- func (f *Formatter) GetFormat() string
- func (f *Formatter) SetIncludeEmptyLines(include bool)
- type SplitTreeNode
- type TabInfo
- type TableData
- type TreeNode
- type Trigger
- type WindowInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatNotification ¶
func FormatNotification(notification *pb.Notification, notificationType string) string
FormatNotification formats a notification for display.
func MakeSessionIDHyperlink ¶
MakeSessionIDHyperlink creates a clickable session ID hyperlink. When clicked in iTerm2, opens the iterm2://session/activate/<id> URL.
func MakeTabIDHyperlink ¶
MakeTabIDHyperlink creates a clickable tab ID hyperlink. When clicked in iTerm2, opens the iterm2://tab/activate/<id> URL.
func MakeWindowIDHyperlink ¶
MakeWindowIDHyperlink creates a clickable window ID hyperlink. When clicked in iTerm2, opens the iterm2://window/activate/<id> URL.
func OSC8Hyperlink ¶
OSC8Hyperlink wraps text in an OSC 8 terminal hyperlink escape sequence. The format is: ESC ]8;;URI ESC \ text ESC ]8;; ESC \
Parameters:
- url: The target URI (e.g., "iterm2://session/activate/ABC123")
- text: The display text to show as a clickable link
Returns the text wrapped in OSC 8 sequences, or just the text if hyperlinks are disabled.
Reference: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
func PrintJSON ¶
func PrintJSON(v interface{}) error
PrintJSON is a convenience function for printing JSON output.
func PrintYAML ¶
func PrintYAML(v interface{}) error
PrintYAML is a convenience function for printing YAML output.
func SessionActivateURL ¶
SessionActivateURL generates an it2:// URL for activating a session. Format: it2://session/activate/<session-id>
func SupportsOSC8 ¶
func SupportsOSC8() bool
SupportsOSC8 detects if the current terminal supports OSC 8 hyperlinks. Returns true if the terminal is known to support OSC 8, false otherwise.
Supported terminals:
- iTerm2 (TERM_PROGRAM=iTerm.app)
- WezTerm (TERM_PROGRAM=WezTerm)
- VSCode terminal (TERM_PROGRAM=vscode)
- Kitty (TERM=xterm-kitty)
- Terminals with VTE >= 0.50 (TERM contains "vte")
Hyperlinks are automatically disabled when:
- NO_HYPERLINKS environment variable is set
- Output is not a TTY (piped to watch, tee, files, etc.)
func TabActivateURL ¶
TabActivateURL generates an it2:// URL for activating a tab. Format: it2://tab/activate/<tab-id>
func WindowActivateURL ¶
WindowActivateURL generates an it2:// URL for activating a window. Format: it2://window/activate/<window-id>
Types ¶
type Annotation ¶
type Annotation struct {
ID string `json:"id"`
Text string `json:"text"`
Line int `json:"line,omitempty"`
Column int `json:"column,omitempty"`
Timestamp time.Time `json:"timestamp"`
Type string `json:"type,omitempty"`
}
Annotation represents an annotation for formatting.
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter handles formatting of iTerm2 data structures for display.
func NewWithHyperlinks ¶
func NewWithHyperlinks(format string, columns []string, sortBy string, sortReverse bool, quiet bool, hyperlinks bool) *Formatter
NewWithHyperlinks creates a new formatter with full options including hyperlinks.
func NewWithOptions ¶
func NewWithOptions(format string, columns []string, sortBy string, sortReverse bool, quiet bool) *Formatter
NewWithOptions creates a new formatter with column and sort options.
func (*Formatter) FormatAlertResponse ¶
FormatAlertResponse formats alert responses (placeholder).
func (*Formatter) FormatAnnotations ¶
func (f *Formatter) FormatAnnotations(annotations []*Annotation) error
FormatAnnotations formats annotation information.
func (*Formatter) FormatBroadcastDomains ¶
func (f *Formatter) FormatBroadcastDomains(domains []*client.BroadcastDomain) error
FormatBroadcastDomains formats broadcast domain information.
func (*Formatter) FormatBuffer ¶
func (f *Formatter) FormatBuffer(resp *pb.GetBufferResponse) error
FormatBuffer formats buffer contents.
func (*Formatter) FormatBufferEscaped ¶
func (f *Formatter) FormatBufferEscaped(resp *pb.GetBufferResponse, includeColors bool) error
FormatBufferEscaped formats buffer contents with escape sequences shown as visible characters (like cat -v).
func (*Formatter) FormatBufferWithColors ¶
func (f *Formatter) FormatBufferWithColors(resp *pb.GetBufferResponse) error
FormatBufferWithColors formats buffer contents with ANSI color codes.
func (*Formatter) FormatClientWindows ¶
func (f *Formatter) FormatClientWindows(windows []*client.WindowInfo) error
FormatClientWindows formats client.WindowInfo from the client package.
func (*Formatter) FormatCursor ¶
FormatCursor formats cursor position and state information.
func (*Formatter) FormatCustomControlResponse ¶
FormatCustomControlResponse formats custom control responses (placeholder).
func (*Formatter) FormatFilePanelResponse ¶
FormatFilePanelResponse formats file panel responses (placeholder).
func (*Formatter) FormatFindResults ¶
func (f *Formatter) FormatFindResults(results []*client.FindResult, showLineNumbers bool) error
FormatFindResults formats text search results.
func (*Formatter) FormatGeneric ¶
FormatGeneric formats any interface{} as JSON.
func (*Formatter) FormatHighlightResults ¶
func (f *Formatter) FormatHighlightResults(results []*client.HighlightResult) error
FormatHighlightResults formats text highlighting results.
func (*Formatter) FormatKeyBindings ¶
FormatKeyBindings formats keyboard bindings output.
func (*Formatter) FormatLifecycleResponse ¶
FormatLifecycleResponse formats lifecycle responses (placeholder).
func (*Formatter) FormatReplaceResults ¶
func (f *Formatter) FormatReplaceResults(results []*client.ReplaceResult) error
FormatReplaceResults formats text replacement results.
func (*Formatter) FormatSelection ¶
FormatSelection formats a selection for display.
func (*Formatter) FormatSessions ¶
func (f *Formatter) FormatSessions(sessions []*client.SessionInfo) error
FormatSessions formats a list of sessions for display.
func (*Formatter) FormatSessionsWithRawTree ¶
func (f *Formatter) FormatSessionsWithRawTree(listResp *pb.ListSessionsResponse, sessions []*client.SessionInfo) error
FormatSessionsWithRawTree formats sessions using the raw split tree structure from iTerm2.
func (*Formatter) FormatStringList ¶
FormatStringList formats a list of strings with an optional title.
func (*Formatter) FormatTabInfo ¶
FormatTabInfo formats single tab information.
func (*Formatter) FormatTabResponse ¶
func (f *Formatter) FormatTabResponse(resp *pb.CreateTabResponse) error
FormatTabResponse formats a tab creation response.
func (*Formatter) FormatTable ¶
FormatTable formats data as a table with aligned columns
func (*Formatter) FormatTabs ¶
FormatTabs formats tab information.
func (*Formatter) FormatTmuxConnections ¶
func (f *Formatter) FormatTmuxConnections(connections []*client.TmuxConnection) error
FormatTmuxConnections formats tmux connection information.
func (*Formatter) FormatTriggers ¶
FormatTriggers formats trigger information.
func (*Formatter) SetIncludeEmptyLines ¶
SetIncludeEmptyLines sets whether to include trailing empty lines in buffer output.
type SplitTreeNode ¶
type SplitTreeNode struct {
IsSession bool // True if this is a session, false if it's a split container
IsVertical bool // Direction of split (only relevant if IsSession=false)
SessionID string // Only set if IsSession=true
ShortID string // Only set if IsSession=true
Name string // Only set if IsSession=true
CurrentCommand string // Only set if IsSession=true
ShellPID int32 // Only set if IsSession=true
JobPID int32 // Only set if IsSession=true
PromptState string // Only set if IsSession=true
PluginData map[string]interface{} // Only set if IsSession=true
Children []*SplitTreeNode // Child nodes (either sessions or more splits)
}
SplitTreeNode represents a node in the panel hierarchy (can be a session or a split container).
type TabInfo ¶
type TabInfo struct {
TabID string `json:"tab_id"`
WindowID string `json:"window_id"`
WindowNumber int `json:"window_number"`
Title string `json:"title,omitempty"`
Active bool `json:"active"`
Position int `json:"position"`
Sessions []*client.SessionInfo `json:"sessions,omitempty"`
PluginData map[string]interface{} `json:"plugin_data,omitempty"`
}
TabInfo represents tab information for formatting.
type TableData ¶
TableData represents data to be displayed in a table format
func NewTableData ¶
NewTableData creates a new TableData with headers
func (*TableData) SelectColumns ¶
SelectColumns filters the table to only show specified columns
type TreeNode ¶
type TreeNode struct {
SessionID string
ShortID string
Name string
ParentID string
SplitVertical *bool // Direction of split from parent (nil if no parent, true=vertical, false=horizontal)
Children []*TreeNode
CurrentCommand string
ShellPID int32
JobPID int32
PromptState string
PluginData map[string]interface{}
}
TreeNode represents a session in the tree hierarchy.
type Trigger ¶
type Trigger struct {
ID string `json:"id"`
Pattern string `json:"pattern"`
Action string `json:"action"`
Enabled bool `json:"enabled"`
Created time.Time `json:"created"`
}
Trigger represents a trigger for formatting.
type WindowInfo ¶
type WindowInfo struct {
WindowID string `json:"window_id"`
Name string `json:"name,omitempty"`
Title string `json:"title,omitempty"`
Frame string `json:"frame,omitempty"`
Fullscreen string `json:"fullscreen,omitempty"`
Miniaturized string `json:"miniaturized,omitempty"`
TabCount int `json:"tab_count"`
PluginData map[string]interface{} `json:"plugin_data,omitempty"`
}
WindowInfo represents window information for formatting.