prompt

package
v0.0.0-...-5d475a2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 14 Imported by: 0

README

prompt package

This is for the Prompt modal of superfile

Handles user input updates, spf model updates, and returns a PromptAction to model.

Coverage

cd /path/to/ui/prompt
# Basic coverage
go test -cover

# HTML report
go test -coverprofile=coverage.out && go tool cover -html=coverage.out -o coverage.html

Current coverage is 91.3%.

Documentation

Index

Constants

View Source
const (
	OpenCommand          = "open"
	SplitCommand         = "split"
	CdCommand            = "cd"
	ContentSearchCommand = "content"

	PromptMinWidth  = 10
	PromptMinHeight = 3
)

These could as well be property of prompt Model vs being global consts But its fine

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

No need to name it as PromptModel. It will me imported as prompt.Model

func DefaultModel

func DefaultModel(maxHeight int, width int) Model

func GenerateModel

func GenerateModel(spfPromptHotkey string, shellPromptHotkey string, closeOnSuccess bool,
	maxHeight int, width int) Model

func (*Model) Close

func (m *Model) Close()

func (*Model) CloseOnSuccessIfNeeded

func (m *Model) CloseOnSuccessIfNeeded()

func (*Model) GetMaxHeight

func (m *Model) GetMaxHeight() int

func (*Model) GetWidth

func (m *Model) GetWidth() int

func (*Model) HandleSPFActionResults

func (m *Model) HandleSPFActionResults(success bool, msg string)

After action is performed, model will update the prompt.Model with results In case of NoAction, this method should not be called.

func (*Model) HandleShellCommandResults

func (m *Model) HandleShellCommandResults(retCode int, _ string)

After action is performed, model will update the Model with results

func (*Model) HandleUpdate

func (m *Model) HandleUpdate(msg tea.Msg, cwdLocation string) (common.ModelAction, tea.Cmd)

func (*Model) IsOpen

func (m *Model) IsOpen() bool

func (*Model) IsShellMode

func (m *Model) IsShellMode() bool

func (*Model) LastActionSucceeded

func (m *Model) LastActionSucceeded() bool

func (*Model) Open

func (m *Model) Open(shellMode bool)

func (*Model) OpenSPFWithPrefill

func (m *Model) OpenSPFWithPrefill(prefill string)

func (*Model) Render

func (m *Model) Render() string

func (*Model) SetMaxHeight

func (m *Model) SetMaxHeight(maxHeight int)

func (*Model) SetWidth

func (m *Model) SetWidth(width int)

Jump to

Keyboard shortcuts

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