action

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCancelled = errors.New("action cancelled")

ErrCancelled indicates the user cancelled without choosing an action.

View Source
var ErrEmptyRefinement = errors.New("empty refinement query")

ErrEmptyRefinement indicates the user submitted an empty refinement query.

Functions

func CopyToClipboard

func CopyToClipboard(command string) error

CopyToClipboard copies the given command string to the system clipboard.

func Execute

func Execute(command string) error

Execute runs the given command string in the user's shell. In shell integration mode (stdout=pipe, stderr=TTY), output is routed to /dev/tty so it appears on the terminal instead of being captured by $(). If stdin is a terminal it is passed through; otherwise /dev/tty is opened so the subprocess can receive interactive input.

func PromptAction

func PromptAction(command string) error

PromptAction displays the selected command and an action menu, then dispatches the chosen action. It reads input from /dev/tty to avoid conflicts with piped stdin.

func ReadRefinement added in v0.8.0

func ReadRefinement() (string, error)

ReadRefinement opens /dev/tty, sets raw mode, and uses term.NewTerminal to read one line with built-in echo. This avoids relying on the terminal driver's ECHO flag which may be left disabled after bubbletea exits.

func ShouldPrompt

func ShouldPrompt() bool

ShouldPrompt returns true if stdout is a TTY, meaning the user is interacting directly with the terminal and should see the action menu.

func ShouldPromptStderr added in v0.8.0

func ShouldPromptStderr() bool

ShouldPromptStderr returns true if stderr is a TTY. Used in shell integration mode where stdout is captured but stderr goes to /dev/tty.

Types

type Action

type Action int

Action represents a post-selection action chosen by the user.

const (
	ActionExecute Action = iota
	ActionCopy
	ActionRevise
	ActionQuit
	ActionCancel
)

type ExitError

type ExitError struct {
	Code int
}

ExitError wraps a subprocess exit code so callers can propagate it.

func (*ExitError) Error

func (e *ExitError) Error() string

type ReviseRequestedError added in v0.8.0

type ReviseRequestedError struct{}

ReviseRequestedError indicates the user wants to revise the selected command.

func (*ReviseRequestedError) Error added in v0.8.0

func (e *ReviseRequestedError) Error() string

Jump to

Keyboard shortcuts

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