tui

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionTitle

func ActionTitle(action sunbeam.Action) string

func AnsiStyle

func AnsiStyle() ansi.StyleConfig

func Draw

func Draw(page Page) error

func ExitCmd

func ExitCmd() tea.Msg

func ExtractPreferencesFromEnv

func ExtractPreferencesFromEnv(alias string, extension extensions.Extension) (map[string]any, error)

func FindMissingInputs

func FindMissingInputs(inputs []sunbeam.Input, params map[string]any) []sunbeam.Input

func FindMissingPreferences

func FindMissingPreferences(preferenceInputs []sunbeam.Input, values map[string]any) []sunbeam.Input

func PopPageCmd

func PopPageCmd() tea.Msg

func PushPageCmd

func PushPageCmd(page Page) tea.Cmd

func RenderItem

func RenderItem(title string, subtitle string, accessories []string, width int, selected bool) string

Types

type Checkbox

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

func NewCheckbox

func NewCheckbox(param sunbeam.Input) *Checkbox

func (*Checkbox) Blur

func (cb *Checkbox) Blur()

func (*Checkbox) Focus

func (cb *Checkbox) Focus() tea.Cmd

func (*Checkbox) Height

func (cb *Checkbox) Height() int

func (*Checkbox) Name

func (cb *Checkbox) Name() string

func (*Checkbox) SetWidth

func (cb *Checkbox) SetWidth(width int)

func (*Checkbox) Title

func (cb *Checkbox) Title() string

func (*Checkbox) Toggle

func (cb *Checkbox) Toggle()

func (Checkbox) Update

func (cb Checkbox) Update(msg tea.Msg) (Input, tea.Cmd)

func (Checkbox) Value

func (cb Checkbox) Value() any

func (Checkbox) View

func (cb Checkbox) View() string

type Detail

type Detail struct {
	Style    lipgloss.Style
	Markdown bool
	// contains filtered or unexported fields
}

func NewDetail

func NewDetail(text string, actions ...sunbeam.Action) *Detail

func NewErrorPage

func NewErrorPage(err error, additionalActions ...sunbeam.Action) *Detail

func (*Detail) Blur

func (d *Detail) Blur() tea.Cmd

func (*Detail) Focus

func (d *Detail) Focus() tea.Cmd

func (*Detail) Init

func (d *Detail) Init() tea.Cmd

func (*Detail) RefreshContent

func (c *Detail) RefreshContent() error

func (*Detail) SetIsLoading

func (d *Detail) SetIsLoading(isLoading bool) tea.Cmd

func (*Detail) SetSize

func (c *Detail) SetSize(width, height int)

func (*Detail) Update

func (c *Detail) Update(msg tea.Msg) (Page, tea.Cmd)

func (*Detail) View

func (c *Detail) View() string

type DetailMsg

type DetailMsg string

type ExitMsg

type ExitMsg struct {
}

type Filter

type Filter struct {
	Width, Height int
	Query         string
	Less          func(i, j FilterItem) bool
	EmptyText     string

	DrawLines bool
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter(items ...FilterItem) Filter

func (*Filter) CursorDown

func (m *Filter) CursorDown()

func (*Filter) CursorUp

func (m *Filter) CursorUp()

func (*Filter) FilterItems

func (f *Filter) FilterItems(query string)

func (Filter) Init

func (m Filter) Init() tea.Cmd

func (*Filter) ResetSelection

func (f *Filter) ResetSelection()

func (*Filter) Select

func (f *Filter) Select(id string)

func (Filter) Selection

func (f Filter) Selection() FilterItem

func (*Filter) SetItems

func (f *Filter) SetItems(items ...FilterItem)

func (*Filter) SetSize

func (f *Filter) SetSize(width, height int)

func (Filter) Update

func (f Filter) Update(msg tea.Msg) (Filter, tea.Cmd)

func (Filter) View

func (m Filter) View() string

type FilterItem

type FilterItem interface {
	FilterValue() string
	Render(width int, selected bool) string
	ID() string
}

type Form

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

func NewForm

func NewForm(submitMsg func(map[string]any) tea.Msg, params ...sunbeam.Input) *Form

func (*Form) Blur

func (c *Form) Blur() tea.Cmd

func (*Form) CurrentItem

func (c *Form) CurrentItem() Input

func (Form) Focus

func (c Form) Focus() tea.Cmd

func (Form) Init

func (c Form) Init() tea.Cmd

func (*Form) ScrollViewport

func (c *Form) ScrollViewport()

func (*Form) SetIsLoading

func (c *Form) SetIsLoading(isLoading bool) tea.Cmd

func (*Form) SetSize

func (c *Form) SetSize(width, height int)

func (Form) Update

func (c Form) Update(msg tea.Msg) (Page, tea.Cmd)

func (*Form) View

func (c *Form) View() string

type HideNotificationMsg

type HideNotificationMsg struct{}

type History

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

func LoadHistory

func LoadHistory(fp string) (History, error)

func (History) Save

func (h History) Save() error

func (History) Sort

func (h History) Sort(items []sunbeam.ListItem)

type Input

type Input interface {
	Name() string
	Title() string
	Value() any

	Focus() tea.Cmd
	Blur()

	Height() int

	SetWidth(int)
	Update(tea.Msg) (Input, tea.Cmd)
	View() string
}

func NewNumberField

func NewNumberField(param sunbeam.Input) Input

func NewTextArea

func NewTextArea(input sunbeam.Input) Input

type List

type List struct {
	Actions       []sunbeam.Action
	OnQueryChange func(string) tea.Cmd
	OnSelect      func(string) tea.Cmd
	// contains filtered or unexported fields
}

func NewList

func NewList(items ...sunbeam.ListItem) *List

func (*List) Blur

func (c *List) Blur() tea.Cmd

func (*List) FilterItems

func (c *List) FilterItems(query string)

func (*List) Focus

func (c *List) Focus() tea.Cmd

func (*List) Init

func (c *List) Init() tea.Cmd

func (List) Query

func (c List) Query() string

func (*List) ResetSelection

func (l *List) ResetSelection()

func (List) Selection

func (c List) Selection() (sunbeam.ListItem, bool)

func (*List) SetActions

func (l *List) SetActions(actions ...sunbeam.Action)

func (*List) SetEmptyText

func (l *List) SetEmptyText(text string)

func (*List) SetIsLoading

func (c *List) SetIsLoading(isLoading bool) tea.Cmd

func (*List) SetItems

func (c *List) SetItems(items ...sunbeam.ListItem)

func (*List) SetQuery

func (c *List) SetQuery(query string) tea.Cmd

func (*List) SetShowDetail

func (c *List) SetShowDetail(showDetail bool)

func (*List) SetSize

func (c *List) SetSize(width, height int)

func (*List) Update

func (c *List) Update(msg tea.Msg) (Page, tea.Cmd)

func (List) View

func (c List) View() string

type ListFocus

type ListFocus string
var (
	ListFocusItems   ListFocus = "items"
	ListFocusActions ListFocus = "actions"
)

type ListItem

type ListItem sunbeam.ListItem

Probably not necessary, need to be refactored

func (ListItem) FilterValue

func (i ListItem) FilterValue() string

func (ListItem) ID

func (i ListItem) ID() string

func (ListItem) Render

func (i ListItem) Render(width int, selected bool) string

type NumberField

type NumberField struct {
	*TextField
}

func (NumberField) Update

func (n NumberField) Update(msg tea.Msg) (Input, tea.Cmd)

func (NumberField) Value

func (n NumberField) Value() any

type Page

type Page interface {
	Init() tea.Cmd
	Update(tea.Msg) (Page, tea.Cmd)
	View() string

	Focus() tea.Cmd
	Blur() tea.Cmd

	SetSize(width, height int)
}

type Paginator

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

func NewPaginator

func NewPaginator(root Page) *Paginator

func (*Paginator) Init

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

func (*Paginator) Pop

func (m *Paginator) Pop() tea.Cmd

func (*Paginator) Push

func (m *Paginator) Push(page Page) tea.Cmd

func (*Paginator) SetSize

func (m *Paginator) SetSize(width, height int)

func (*Paginator) Update

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

func (*Paginator) View

func (m *Paginator) View() string

type PopPageMsg

type PopPageMsg struct{}

type PushPageMsg

type PushPageMsg struct {
	Page Page
}

type QueryChangeMsg

type QueryChangeMsg string

type ReloadMsg

type ReloadMsg struct{}

type RootList

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

func NewRootList

func NewRootList(title string, history history.History, generator func() (config.Config, []sunbeam.ListItem, error)) *RootList

func (*RootList) Blur

func (c *RootList) Blur() tea.Cmd

func (*RootList) Focus

func (c *RootList) Focus() tea.Cmd

func (*RootList) Init

func (c *RootList) Init() tea.Cmd

func (*RootList) Reload

func (c *RootList) Reload() tea.Cmd

func (*RootList) SetError

func (c *RootList) SetError(err error) tea.Cmd

func (*RootList) SetSize

func (c *RootList) SetSize(width, height int)

func (*RootList) Update

func (c *RootList) Update(msg tea.Msg) (Page, tea.Cmd)

func (*RootList) View

func (c *RootList) View() string

type Runner

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

func NewRunner

func NewRunner(extension extensions.Extension, input sunbeam.Payload) *Runner

func (*Runner) Blur

func (c *Runner) Blur() tea.Cmd

func (*Runner) Focus

func (c *Runner) Focus() tea.Cmd

func (*Runner) Init

func (c *Runner) Init() tea.Cmd

func (*Runner) Reload

func (c *Runner) Reload() tea.Cmd

func (*Runner) SetIsLoading

func (c *Runner) SetIsLoading(isLoading bool) tea.Cmd

func (*Runner) SetSize

func (c *Runner) SetSize(w int, h int)

func (*Runner) Update

func (c *Runner) Update(msg tea.Msg) (Page, tea.Cmd)

func (*Runner) View

func (c *Runner) View() string

type ShowNotificationMsg

type ShowNotificationMsg struct {
	Title string
}

type StatusBar

type StatusBar struct {
	Width int
	// contains filtered or unexported fields
}

func NewStatusBar

func NewStatusBar(actions ...sunbeam.Action) StatusBar

func (*StatusBar) FilterActions

func (c *StatusBar) FilterActions(query string)

func (*StatusBar) Reset

func (c *StatusBar) Reset()

func (*StatusBar) SetActions

func (c *StatusBar) SetActions(actions ...sunbeam.Action)

func (StatusBar) Update

func (p StatusBar) Update(msg tea.Msg) (StatusBar, tea.Cmd)

func (StatusBar) View

func (c StatusBar) View() string

type TextArea

type TextArea struct {
	textarea.Model
	// contains filtered or unexported fields
}

func (*TextArea) Height

func (ta *TextArea) Height() int

func (*TextArea) Name

func (ta *TextArea) Name() string

func (*TextArea) SetWidth

func (ta *TextArea) SetWidth(w int)

func (*TextArea) Title

func (ta *TextArea) Title() string

func (*TextArea) Update

func (ta *TextArea) Update(msg tea.Msg) (Input, tea.Cmd)

func (*TextArea) Value

func (ta *TextArea) Value() any

type TextField

type TextField struct {
	textinput.Model
	// contains filtered or unexported fields
}

func NewTextField

func NewTextField(input sunbeam.Input, secure bool) *TextField

func (*TextField) Height

func (ti *TextField) Height() int

func (*TextField) Name

func (ti *TextField) Name() string

func (*TextField) SetWidth

func (ti *TextField) SetWidth(width int)

func (*TextField) Title

func (ti *TextField) Title() string

func (*TextField) Update

func (ti *TextField) Update(msg tea.Msg) (Input, tea.Cmd)

func (*TextField) Value

func (ti *TextField) Value() any

func (TextField) View

func (ti TextField) View() string

Jump to

Keyboard shortcuts

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