ui

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package ui contains terminal UI flows used by the CLI.

Package ui contains the BubbleTea model for pgxcli's interactive prompt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Banner(version string) string

func PrintCmd

func PrintCmd(text string, style lipgloss.Style) tea.Cmd

PrintCmd returns a command that prints formatted text.

func PrintErrCmd

func PrintErrCmd(err error, style lipgloss.Style) tea.Cmd

PrintErrCmd returns a command that prints a formatted error.

func ShowPagerCmd

func ShowPagerCmd(cmd *exec.Cmd) tea.Cmd

ShowPagerCmd returns a command to execute a pager process.

Types

type ConfirmQuitMsg added in v0.2.0

type ConfirmQuitMsg struct{}

ConfirmQuitMsg is used internally to finalize quitting.

type ConnectionValues added in v0.2.0

type ConnectionValues struct {
	Database string
	Username string
	Port     string
	Host     string
	Password string
}

ConnectionValues contains connection details collected from the interactive form.

func RunConnectionForm added in v0.2.0

func RunConnectionForm(database, username, host, port string) (ConnectionValues, error)

RunConnectionForm starts the interactive connection form and returns collected values.

type ExecCmdMsg

type ExecCmdMsg struct{ Cmd tea.Cmd }

ExecCmdMsg is used to dispatch a batch/sequence of commands.

type KeyMap added in v0.2.0

type KeyMap struct {
	Quit      key.Binding
	Interrupt key.Binding
}

KeyMap defines the keybindings for the application.

func DefaultKeyMap added in v0.2.0

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default keybindings.

type Model

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

func New

func New(initialPrefix string, pgKeywords []string, historyFile string, style string, version string, executeFunc execute, cancelFunc cancel) (*Model, error)

func (*Model) Close

func (m *Model) Close() error

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Model) View

func (m *Model) View() tea.View

type QuitRequestMsg added in v0.2.0

type QuitRequestMsg struct{}

QuitRequestMsg signals that the app wants to quit.

type ReadyMsg

type ReadyMsg struct{ Prefix string }

ReadyMsg signals the ui that execution is done and it should prompt.

type State added in v0.2.0

type State int
const (
	StateInput State = iota
	StateExecuting
)

type Styles added in v0.2.0

type Styles struct {
	// UserInput styles the user's input query after enter key is pressed.
	UserInput lipgloss.Style
	// AppOutput styles the output from the application after executing the query.
	AppOutput lipgloss.Style
	// ErrorOutput styles the error output from the application after executing the query.
	ErrorOutput lipgloss.Style

	// UserInputSepartor styles the separator between user input from previous result.
	UserInputSepartor lipgloss.Style

	// InputSeparator is a top and bottom border for editline input area.
	InputSeparator lipgloss.Style

	// Spinner styles the spinner animation.
	Spinner        lipgloss.Style
	SpinnerCaption lipgloss.Style

	// StatusBar styles the status bar at the bottom.
	StatusBar lipgloss.Style
}

func DefaultStyles added in v0.2.0

func DefaultStyles() Styles

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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