ui

package
v0.0.0-...-7ad5d0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TodoMenuAdd  = "add"
	TodoMenuEdit = "edit"
	TodoMenuBack = "back"
)
View Source
const (
	HeaderPrefixSuffix = "──"
)

Variables

View Source
var ErrInputCancelled = errors.New("input cancelled")

ErrInputCancelled is returned when user cancels input with Escape or Ctrl+C

Functions

func AddLineNumbers

func AddLineNumbers(content string) string

func ClearLine

func ClearLine() error

func Colorize

func Colorize(c Color, s string) string

func ColorizeDiff

func ColorizeDiff(diff string) string

func ConfirmAction

func ConfirmAction(action, connectionName string) (bool, error)

ConfirmAction prompts the user to confirm an action

func CreateReadlineCompletions

func CreateReadlineCompletions(commands []ic.Command) []readline.PrefixCompleterInterface

func DisplayBanner

func DisplayBanner()

DisplayBanner shows the TIM banner at the top of the terminal

func FormatConnectionList

func FormatConnectionList(result *client.ConnectionsResponse) error

func FormatConnectionOperationResult

func FormatConnectionOperationResult(result *client.ConnectionOperationResponse) error

func Height

func Height() int

func Print

func Print(a ...interface{}) (n int, err error)

func PrintBox

func PrintBox(b *Box)

func Printf

func Printf(format string, a ...interface{}) (n int, err error)

func Println

func Println(a ...interface{}) (n int, err error)

func PromptForAuthToken

func PromptForAuthToken(prompt string) (string, error)

PromptForAuthToken prompts for an authentication token with cancellation support

func SelectConnectionWithArrowKeys

func SelectConnectionWithArrowKeys(connections []client.MCPServerInfo, prompt string) (*client.MCPServerInfo, error)

SelectConnectionWithArrowKeys allows user to select a connection using arrow keys

func SetColorOutput

func SetColorOutput(force bool)

SetColorOutput allows configuring whether color output is forced.

func ShowSessionsMenu

func ShowSessionsMenu(timClient *client.TimClient) (*client.SessionInfoResponse, error)

func Size

func Size() (int, int)

func TodoIcon

func TodoIcon(status session.TodoStatus, priority session.TodoPriority) string

TodoIcon returns a colored icon for the given status and priority

func TodoStatusFromText

func TodoStatusFromText(status string) session.TodoStatus

TodoStatusFromText returns todo status from the given text

func TodoStatusText

func TodoStatusText(status session.TodoStatus) string

TodoStatusText returns text for the given todo status

func VisualLen

func VisualLen(s string) int

func Width

func Width() int

Types

type Box

type Box struct {
	Title       string
	Content     string
	BorderColor Color
	WrapContent bool
}

type ChoiceResult

type ChoiceResult struct {
	SelectedIndex int
	SelectedValue string
	Cancelled     bool
}

ChoiceResult holds the result of a choice selection

type Color

type Color int
const (
	ColorUnspecified Color = iota
	ColorBlack
	ColorRed
	ColorGreen
	ColorYellow
	ColorBlue
	ColorMagenta
	ColorCyan
	ColorWhite
	ColorHiBlack
	ColorHiRed
	ColorHiGreen
	ColorHiYellow
	ColorHiBlue
	ColorHiMagenta
	ColorHiCyan
)

type CommandSelector

type CommandSelector struct {
	// contains filtered or unexported fields
}

func NewCommandSelector

func NewCommandSelector(allCommands []ic.Command, logger *logger.Logger) *CommandSelector

func (*CommandSelector) HandleInput

func (cs *CommandSelector) HandleInput(char byte) (bool, string)

func (*CommandSelector) IsActive

func (cs *CommandSelector) IsActive() bool

func (*CommandSelector) Show

func (cs *CommandSelector) Show()

type ConnectionAddPromptResult

type ConnectionAddPromptResult struct {
	Name         string
	Description  string
	Remote       bool
	Command      string
	URL          string
	Args         []string
	IsPreset     bool
	PresetChoice string
	PresetIndex  int // Index in the original preset list for mapping
}

ConnectionAddPromptResult contains the result of the interactive connection add prompt

func ConnectionAddPromptWithPresets

func ConnectionAddPromptWithPresets(presetOptions []string) (*ConnectionAddPromptResult, error)

ConnectionAddPromptWithPresets prompts the user for information to add a new connection with preset options

type ConnectionSelectionDisplay

type ConnectionSelectionDisplay struct {
	// contains filtered or unexported fields
}

ConnectionSelectionDisplay encapsulates the display state and logic for connection selection

func NewConnectionSelectionDisplay

func NewConnectionSelectionDisplay(connections []client.MCPServerInfo, prompt string) *ConnectionSelectionDisplay

NewConnectionSelectionDisplay creates a new connection selection display manager

func (*ConnectionSelectionDisplay) Clear

func (d *ConnectionSelectionDisplay) Clear()

Clear clears the selection display with state validation

func (*ConnectionSelectionDisplay) Display

func (d *ConnectionSelectionDisplay) Display()

Display shows the initial connection selection with header and content

func (*ConnectionSelectionDisplay) GetSelected

GetSelected returns the currently selected connection

func (*ConnectionSelectionDisplay) MoveDown

func (d *ConnectionSelectionDisplay) MoveDown() bool

MoveDown moves the selection down if possible and returns true if moved

func (*ConnectionSelectionDisplay) MoveUp

func (d *ConnectionSelectionDisplay) MoveUp() bool

MoveUp moves the selection up if possible and returns true if moved

func (*ConnectionSelectionDisplay) Update

func (d *ConnectionSelectionDisplay) Update()

Update redraws only the connection list portion with bounds checking

type ConnectionSelector

type ConnectionSelector struct {
	// contains filtered or unexported fields
}

ConnectionSelector provides interactive connection selection functionality

func NewConnectionSelector

func NewConnectionSelector(connections []client.MCPServerInfo, prompt string) *ConnectionSelector

NewConnectionSelector creates a new connection selector

func (*ConnectionSelector) Select

func (s *ConnectionSelector) Select() (*client.MCPServerInfo, error)

Select allows the user to select a connection using arrow keys

type Spinner

type Spinner struct {
	// contains filtered or unexported fields
}

func NewSpinner

func NewSpinner(prefix, message string) *Spinner

func (*Spinner) Pause

func (s *Spinner) Pause()

Pause pauses the spinner animation if it's currently active. Does nothing if the spinner is not active.

func (*Spinner) Resume

func (s *Spinner) Resume()

Resume unpauses the spinner animation if it's currently active and paused. Does nothing if the spinner is not active and paused.

func (*Spinner) SetMessage

func (s *Spinner) SetMessage(message string)

func (*Spinner) Start

func (s *Spinner) Start()

func (*Spinner) Stop

func (s *Spinner) Stop()

type TerminalWriter

type TerminalWriter struct {
	// contains filtered or unexported fields
}

func NewTerminalWriter

func NewTerminalWriter(w io.Writer) *TerminalWriter

func (*TerminalWriter) Write

func (tw *TerminalWriter) Write(p []byte) (n int, err error)

type TodoMenu

type TodoMenu struct {
	// contains filtered or unexported fields
}

func NewTodoMenu

func NewTodoMenu(items []TodoMenuItem, callbacks TodoMenuCallbacks) *TodoMenu

func (*TodoMenu) HandleInput

func (tm *TodoMenu) HandleInput(char byte) (bool, string)

func (*TodoMenu) Show

func (tm *TodoMenu) Show()

type TodoMenuCallbacks

type TodoMenuCallbacks struct {
	AddTodo           func(title, description, priority string) error
	RemoveTodo        func(id string) error
	UpdateStatus      func(id, status string) error
	UpdatePriority    func(id, priority string) error
	UpdateTitle       func(id, title string) error
	UpdateDescription func(id, description string) error
	RefreshTodos      func() []TodoMenuItem // returns the latest todo items
}

type TodoMenuItem

type TodoMenuItem struct {
	ID          string
	Text        string
	Description string
	Action      string
	TodoItem    *client.TodoItem
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL