Documentation
¶
Index ¶
- Constants
- Variables
- func NewTable(w io.Writer) *tabwriter.Writer
- func RenderFrame(title string, content string, hints []Hint, width int) string
- func RunConfirm(opts RunOptions, spec ConfirmSpec) (bool, error)
- func RunFlow[T any](flow Flow, opts RunOptions) (T, error)
- func RunForm(opts RunOptions, spec FormSpec) (map[string]string, error)
- func RunInput(opts RunOptions, spec InputSpec) (string, error)
- func RunMultiSelect[T comparable](opts RunOptions, spec MultiSelectSpec[T]) ([]T, error)
- func RunSelect[T comparable](opts RunOptions, spec SelectSpec[T]) (T, error)
- func SafetyStyle(level SafetyLevel) lipgloss.Style
- func Spinner(w io.Writer, label string) (stop func())
- func TermWidth() int
- type ActionModel
- type ActionResult
- type ActionSpec
- type App
- type ConfirmModel
- type ConfirmSpec
- type Flow
- type FormModel
- type FormSpec
- type Hint
- type InputField
- type InputModel
- type InputSpec
- type LoadingModel
- type LoadingSpec
- type MultiSelectModel
- func (m *MultiSelectModel[T]) FooterHints() []Hint
- func (m *MultiSelectModel[T]) Init() tea.Cmd
- func (m *MultiSelectModel[T]) SetSize(width, height int)
- func (m *MultiSelectModel[T]) Title() string
- func (m *MultiSelectModel[T]) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *MultiSelectModel[T]) View() string
- type MultiSelectSpec
- type Option
- type OptionUpdateMsg
- type RunOptions
- type SafetyLevel
- type SelectModel
- type SelectSpec
- type Step
Constants ¶
View Source
const AILogo = "⚹"
Variables ¶
View Source
var ( StyleTitle = lipgloss.NewStyle().Foreground(lavender).Bold(true) StyleSelector = lipgloss.NewStyle().Foreground(rose) StyleSelected = lipgloss.NewStyle().Foreground(mint) StyleDescription = lipgloss.NewStyle().Foreground(lipgloss.Color("241")) StyleSeparator = lipgloss.NewStyle().Foreground(lavender) StyleHint = lipgloss.NewStyle().Faint(true) StyleError = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF6B6B")) StyleSafetySafe = lipgloss.NewStyle().Foreground(safetyGreen) StyleSafetyCautious = lipgloss.NewStyle().Foreground(safetyYellow) StyleSafetyRisky = lipgloss.NewStyle().Foreground(safetyOrange) StyleSafetyDestructive = lipgloss.NewStyle().Foreground(safetyRed) StyleWarning = lipgloss.NewStyle().Foreground(safetyRed).Bold(true) AISpinner = spinner.Spinner{ Frames: []string{ lipgloss.NewStyle().Foreground(lavender).Render(AILogo), lipgloss.NewStyle().Foreground(rose).Render(AILogo), lipgloss.NewStyle().Foreground(mint).Render(AILogo), lipgloss.NewStyle().Foreground(sky).Render(AILogo), }, FPS: 200 * time.Millisecond, } )
View Source
var ErrAborted = errors.New("user aborted")
Functions ¶
func RunConfirm ¶
func RunConfirm(opts RunOptions, spec ConfirmSpec) (bool, error)
func RunMultiSelect ¶
func RunMultiSelect[T comparable](opts RunOptions, spec MultiSelectSpec[T]) ([]T, error)
func RunSelect ¶
func RunSelect[T comparable](opts RunOptions, spec SelectSpec[T]) (T, error)
func SafetyStyle ¶
func SafetyStyle(level SafetyLevel) lipgloss.Style
Types ¶
type ActionModel ¶
type ActionModel struct {
// contains filtered or unexported fields
}
func NewActionStep ¶
func NewActionStep(spec ActionSpec) *ActionModel
func (*ActionModel) FooterHints ¶
func (m *ActionModel) FooterHints() []Hint
func (*ActionModel) Init ¶
func (m *ActionModel) Init() tea.Cmd
func (*ActionModel) SetSize ¶
func (m *ActionModel) SetSize(width, _ int)
func (*ActionModel) Title ¶
func (m *ActionModel) Title() string
func (*ActionModel) View ¶
func (m *ActionModel) View() string
type ActionResult ¶
type ActionResult string
const ( ActionApprove ActionResult = "approve" ActionReject ActionResult = "reject" ActionModify ActionResult = "modify" ActionReprompt ActionResult = "reprompt" )
func RunAction ¶
func RunAction(opts RunOptions, spec ActionSpec) (ActionResult, error)
type ActionSpec ¶
type ActionSpec struct {
Command string
Safety SafetyLevel
Breakdown string
}
type ConfirmModel ¶
type ConfirmModel struct {
// contains filtered or unexported fields
}
func NewConfirmStep ¶
func NewConfirmStep(spec ConfirmSpec) *ConfirmModel
func (*ConfirmModel) FooterHints ¶
func (m *ConfirmModel) FooterHints() []Hint
func (*ConfirmModel) Init ¶
func (m *ConfirmModel) Init() tea.Cmd
func (*ConfirmModel) SetSize ¶
func (m *ConfirmModel) SetSize(width, _ int)
func (*ConfirmModel) Title ¶
func (m *ConfirmModel) Title() string
func (*ConfirmModel) View ¶
func (m *ConfirmModel) View() string
type ConfirmSpec ¶
type FormModel ¶
type FormModel struct {
// contains filtered or unexported fields
}
func NewFormStep ¶
func (*FormModel) FooterHints ¶
type FormSpec ¶
type FormSpec struct {
Title string
Fields []InputField
}
type InputField ¶
type InputModel ¶
type InputModel struct {
// contains filtered or unexported fields
}
func NewInputStep ¶
func NewInputStep(spec InputSpec) *InputModel
func (*InputModel) FooterHints ¶
func (m *InputModel) FooterHints() []Hint
func (*InputModel) Init ¶
func (m *InputModel) Init() tea.Cmd
func (*InputModel) SetSize ¶
func (m *InputModel) SetSize(width, _ int)
func (*InputModel) Title ¶
func (m *InputModel) Title() string
func (*InputModel) View ¶
func (m *InputModel) View() string
type LoadingModel ¶
type LoadingModel[T any] struct { // contains filtered or unexported fields }
func NewLoading ¶
func NewLoading[T any](spec LoadingSpec[T]) *LoadingModel[T]
func (*LoadingModel[T]) FooterHints ¶
func (m *LoadingModel[T]) FooterHints() []Hint
func (*LoadingModel[T]) Init ¶
func (m *LoadingModel[T]) Init() tea.Cmd
func (*LoadingModel[T]) SetSize ¶
func (m *LoadingModel[T]) SetSize(width, _ int)
func (*LoadingModel[T]) Title ¶
func (m *LoadingModel[T]) Title() string
func (*LoadingModel[T]) View ¶
func (m *LoadingModel[T]) View() string
type LoadingSpec ¶
type MultiSelectModel ¶
type MultiSelectModel[T comparable] struct { // contains filtered or unexported fields }
func NewMultiSelectStep ¶
func NewMultiSelectStep[T comparable](spec MultiSelectSpec[T]) *MultiSelectModel[T]
func (*MultiSelectModel[T]) FooterHints ¶
func (m *MultiSelectModel[T]) FooterHints() []Hint
func (*MultiSelectModel[T]) Init ¶
func (m *MultiSelectModel[T]) Init() tea.Cmd
func (*MultiSelectModel[T]) SetSize ¶
func (m *MultiSelectModel[T]) SetSize(width, height int)
func (*MultiSelectModel[T]) Title ¶
func (m *MultiSelectModel[T]) Title() string
func (*MultiSelectModel[T]) View ¶
func (m *MultiSelectModel[T]) View() string
type MultiSelectSpec ¶
type MultiSelectSpec[T comparable] struct { Title string Options []Option[T] Defaults []T Height int }
type Option ¶
type Option[T comparable] struct { Label string Description string Value T Loading bool }
type OptionUpdateMsg ¶
type SafetyLevel ¶
type SafetyLevel string
const ( SafetySafe SafetyLevel = "safe" SafetyCautious SafetyLevel = "cautious" SafetyRisky SafetyLevel = "risky" SafetyDestructive SafetyLevel = "destructive" )
type SelectModel ¶
type SelectModel[T comparable] struct { // contains filtered or unexported fields }
func NewSelectStep ¶
func NewSelectStep[T comparable](spec SelectSpec[T]) *SelectModel[T]
func (*SelectModel[T]) FooterHints ¶
func (m *SelectModel[T]) FooterHints() []Hint
func (*SelectModel[T]) Init ¶
func (m *SelectModel[T]) Init() tea.Cmd
func (*SelectModel[T]) SetSize ¶
func (m *SelectModel[T]) SetSize(width, height int)
func (*SelectModel[T]) Title ¶
func (m *SelectModel[T]) Title() string
func (*SelectModel[T]) View ¶
func (m *SelectModel[T]) View() string
type SelectSpec ¶
Click to show internal directories.
Click to hide internal directories.