simplemenu

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

ui/simplemenu/fixpr_prompt.go

ui/simplemenu/list.go

ui/simplemenu/menu.go

ui/simplemenu/stack_prompt.go

ui/simplemenu/sync_prompt.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunFixPrPrompt

func RunFixPrPrompt() (string, string, bool)

RunFixPrPrompt shows a prompt for the fix-pr command

func RunMenu

func RunMenu() string

RunMenu shows a simple command selection menu and returns the selected command

func RunStackPrompt

func RunStackPrompt() (string, string, bool)

RunStackPrompt shows a prompt for the stack command

func RunSyncPrompt

func RunSyncPrompt() ([]string, bool)

RunSyncPrompt shows a prompt for the sync command and returns selected branches

Types

type BasePrompt

type BasePrompt struct {
	Title     string
	ErrorMsg  string
	Cancelled bool
}

BasePrompt provides common functionality for all prompts

func (*BasePrompt) Cancel

func (b *BasePrompt) Cancel()

Cancel marks the prompt as cancelled

func (*BasePrompt) ClearError

func (b *BasePrompt) ClearError()

ClearError clears the error message

func (*BasePrompt) IsCancelled

func (b *BasePrompt) IsCancelled() bool

IsCancelled returns true if the prompt was cancelled

func (*BasePrompt) RenderError

func (b *BasePrompt) RenderError() string

RenderError renders error message if present

func (*BasePrompt) RenderHelpText

func (b *BasePrompt) RenderHelpText(text string) string

RenderHelpText renders help text with consistent styling

func (*BasePrompt) RenderTitle

func (b *BasePrompt) RenderTitle() string

RenderTitle renders the title with consistent styling

func (*BasePrompt) SetError

func (b *BasePrompt) SetError(msg string)

SetError sets an error message

type FixPrPromptModel

type FixPrPromptModel struct {
	BasePrompt
	BranchList     *SelectableList
	TargetList     *SelectableList
	SelectedBranch string
	TargetBranch   string
	State          branchSelectionState
	Git            *core.GitExecutor
}

FixPrPromptModel handles user input for the fix-pr command

func NewFixPrPromptModel

func NewFixPrPromptModel(branches []string, git *core.GitExecutor) FixPrPromptModel

NewFixPrPromptModel creates a new fix-pr prompt model

func (FixPrPromptModel) Init

func (m FixPrPromptModel) Init() tea.Cmd

func (FixPrPromptModel) Update

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

func (FixPrPromptModel) View

func (m FixPrPromptModel) View() string
type MenuItem struct {
	Title   string
	Desc    string
	Emoji   string
	Command string
}
type MenuModel struct {
	Choices  []MenuItem
	Cursor   int
	Selected string
}
func (m MenuModel) Init() tea.Cmd
func (m MenuModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
func (m MenuModel) View() string

type SelectableList

type SelectableList struct {
	Items     []string
	Cursor    int
	Selected  map[int]bool
	OrderMap  map[string]int // Maps item value to selection order
	NextOrder int            // Next order index to assign
}

SelectableList provides a reusable list component

func NewSelectableList

func NewSelectableList(items []string) *SelectableList

NewSelectableList creates a new selectable list

func (*SelectableList) GetSelectedCount

func (l *SelectableList) GetSelectedCount() int

GetSelectedCount returns the number of selected items

func (*SelectableList) GetSelectedItems

func (l *SelectableList) GetSelectedItems() []string

GetSelectedItems returns selected items in order of selection

func (*SelectableList) MoveDown

func (l *SelectableList) MoveDown()

MoveDown moves the cursor down

func (*SelectableList) MoveUp

func (l *SelectableList) MoveUp()

MoveUp moves the cursor up

func (*SelectableList) Render

func (l *SelectableList) Render(showCheckboxes bool, showOrder bool) string

Render renders the list with selection indicators

func (*SelectableList) ToggleSelected

func (l *SelectableList) ToggleSelected()

ToggleSelected toggles selection for current item

type StackPromptModel

type StackPromptModel struct {
	BasePrompt
	NewBranch    string
	ParentBranch string
	CurrentField int
	CursorPos    int
}

StackPromptModel handles user input for the stack command

func NewStackPromptModel

func NewStackPromptModel() StackPromptModel

NewStackPromptModel creates a new stack prompt model

func (StackPromptModel) Init

func (m StackPromptModel) Init() tea.Cmd

func (StackPromptModel) Update

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

func (StackPromptModel) View

func (m StackPromptModel) View() string

type SyncPromptModel

type SyncPromptModel struct {
	BasePrompt
	BranchList *SelectableList
	Step       syncStep
	Git        *core.GitExecutor
}

SyncPromptModel handles branch selection for the sync command

func NewSyncPromptModel

func NewSyncPromptModel(branches []string, git *core.GitExecutor) SyncPromptModel

NewSyncPromptModel creates a new sync prompt model

func (SyncPromptModel) Init

func (m SyncPromptModel) Init() tea.Cmd

func (SyncPromptModel) Update

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

func (SyncPromptModel) View

func (m SyncPromptModel) View() string

Jump to

Keyboard shortcuts

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