tui

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionList

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

func NewActionList

func NewActionList() ActionList

func (*ActionList) Blur

func (al *ActionList) Blur()

func (*ActionList) Clear added in v0.0.9

func (al *ActionList) Clear()

func (*ActionList) Focus

func (al *ActionList) Focus() tea.Cmd

func (ActionList) Focused

func (al ActionList) Focused() bool

func (*ActionList) SetActions

func (al *ActionList) SetActions(actions ...types.Action)

func (*ActionList) SetSize

func (al *ActionList) SetSize(w, h int)

func (*ActionList) SetTitle

func (al *ActionList) SetTitle(title string)

func (ActionList) Update

func (al ActionList) Update(msg tea.Msg) (ActionList, tea.Cmd)

func (ActionList) View

func (al ActionList) View() string

type CmdGenerator added in v0.6.1

type CmdGenerator struct {
	Command string
	Args    []string
	Dir     string
}

type CommandOutput

type CommandOutput []byte

type CommandRunner added in v0.1.0

type CommandRunner struct {
	Generator PageGenerator
	Validator PageValidator
	// contains filtered or unexported fields
}

func NewRunner added in v0.6.1

func NewRunner(generator PageGenerator, validator PageValidator, workingDir string) *CommandRunner

func (*CommandRunner) Init added in v0.1.0

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

func (*CommandRunner) Refresh added in v0.6.1

func (c *CommandRunner) Refresh() tea.Msg

func (*CommandRunner) SetIsloading added in v0.1.0

func (c *CommandRunner) SetIsloading(isLoading bool) tea.Cmd

func (*CommandRunner) SetSize added in v0.1.0

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

func (*CommandRunner) Update added in v0.1.0

func (runner *CommandRunner) Update(msg tea.Msg) (Page, tea.Cmd)

func (*CommandRunner) View added in v0.1.0

func (c *CommandRunner) View() string

type ContentMsg added in v0.6.1

type ContentMsg string

type Detail

type Detail struct {
	Style lipgloss.Style

	Language string

	ContentCmd func() string
	// contains filtered or unexported fields
}

func NewDetail

func NewDetail(title string, contentCmd func() string, actions []types.Action) *Detail

func (*Detail) Init

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

func (*Detail) RefreshContent added in v0.6.1

func (c *Detail) RefreshContent()

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 DropDown struct {
	// contains filtered or unexported fields
}

func NewDropDown

func NewDropDown(formItem types.FormInput) *DropDown
func (d *DropDown) Blur()
func (d *DropDown) Focus() tea.Cmd
func (dd DropDown) HasMatch() bool
func (dd *DropDown) Height() int
func (dd *DropDown) SetWidth(width int)
func (d DropDown) Title() string
func (d *DropDown) Update(msg tea.Msg) (FormInput, tea.Cmd)
func (d DropDown) Value() string
func (dd DropDown) View() string
type DropDownItem struct {
	// contains filtered or unexported fields
}
func (d DropDownItem) FilterValue() string
func (d DropDownItem) ID() string
func (d DropDownItem) Render(width int, selected bool) string

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() 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) Select added in v0.6.1

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 Footer struct {
	Width int
	// contains filtered or unexported fields
}

func NewFooter

func NewFooter(title string) Footer

func (*Footer) SetBindings

func (f *Footer) SetBindings(bindings ...key.Binding)

func (Footer) View

func (f Footer) View() string

type Form

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

func NewForm

func NewForm(inputs []FormItem, submitCmd func(fields map[string]string) tea.Cmd) *Form

func (*Form) CurrentItem added in v0.0.9

func (c *Form) CurrentItem() FormInput

func (Form) Init

func (c Form) Init() tea.Cmd

func (*Form) ScrollViewport added in v0.0.9

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 FormInput

type FormInput interface {
	Focus() tea.Cmd
	Blur()

	Height() int
	Value() string

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

type FormItem

type FormItem struct {
	FormInput
	Title string
	Name  string
}

func NewFormItem

func NewFormItem(param types.FormInput) (FormItem, error)
type Header struct {
	Width int
	// contains filtered or unexported fields
}

func NewHeader

func NewHeader() Header

func (*Header) Focus

func (h *Header) Focus() tea.Cmd

func (Header) Init

func (h Header) Init() tea.Cmd

func (*Header) SetIsLoading

func (h *Header) SetIsLoading(isLoading bool) tea.Cmd

func (Header) Update

func (h Header) Update(msg tea.Msg) (Header, tea.Cmd)

func (Header) Value

func (h Header) Value() string

func (Header) View

func (c Header) View() string

type IsLoadingMsg added in v0.0.9

type IsLoadingMsg struct{}

type List

type List struct {
	DetailFunc func(types.ListItem) string
	Aliases    map[string]types.Action

	GenerateItems bool
	ShowDetail    bool
	// contains filtered or unexported fields
}

func NewList

func NewList(page types.Page, dir string) *List

func (*List) Init

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

func (List) Query

func (c List) Query() string

func (*List) RefreshDetail added in v0.6.1

func (c *List) RefreshDetail()

func (List) Selection added in v0.1.0

func (c List) Selection() *ListItem

func (*List) SetActions added in v0.4.1

func (list *List) SetActions(actions []types.Action)

func (*List) SetIsLoading

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

func (*List) SetItems

func (c *List) SetItems(items []ListItem, selectedId string) tea.Cmd

func (*List) SetQuery added in v0.6.1

func (c *List) SetQuery(query string)

func (*List) SetSize

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

func (*List) SetTitle added in v0.1.0

func (c *List) SetTitle(title string)

func (*List) Update

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

func (List) View

func (c List) View() string

type ListItem

type ListItem struct {
	types.ListItem
}

Probably not necessary, need to be refactored

func ParseScriptItem

func ParseScriptItem(scriptItem types.ListItem) ListItem

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 Match added in v0.6.1

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

type Model

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

func NewModel

func NewModel(root Page) *Model

func (*Model) Draw added in v0.1.0

func (m *Model) Draw() (err error)

func (*Model) Init

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

func (*Model) Pop

func (m *Model) Pop()

func (*Model) Push

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

func (*Model) SetSize

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

func (*Model) Update

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

func (*Model) View

func (m *Model) View() string

type Page added in v0.0.9

type Page interface {
	Init() tea.Cmd
	Update(tea.Msg) (Page, tea.Cmd)
	View() string
	SetSize(width, height int)
}

type PageGenerator added in v0.6.1

type PageGenerator func(input string) ([]byte, error)

func NewCommandGenerator added in v0.6.1

func NewCommandGenerator(command string, args []string, dir string) PageGenerator

func NewFileGenerator added in v0.6.1

func NewFileGenerator(name string) PageGenerator

type PageValidator added in v0.6.1

type PageValidator func([]byte) error

type PopPageMsg added in v0.1.0

type PopPageMsg struct{}

type PushPageMsg added in v0.1.0

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

type RunnerView added in v0.6.1

type RunnerView int
const (
	RunnerViewList RunnerView = iota
	RunnerViewDetail
	RunnerViewLoading
	RunnerViewError
	RunnerViewForm
)

type SelectionChangeMsg added in v0.1.0

type SelectionChangeMsg struct {
	SelectionId string
}

type SubmitFormMsg added in v0.1.0

type SubmitFormMsg struct {
	Id     string
	Values map[string]any
}

type SunbeamOptions added in v0.1.0

type SunbeamOptions struct {
	MaxHeight int
	Padding   int
}

type TextArea

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

func NewTextArea

func NewTextArea(formItem types.FormInput) *TextArea

func (*TextArea) Height

func (ta *TextArea) Height() int

func (*TextArea) SetWidth

func (ta *TextArea) SetWidth(w int)

func (*TextArea) Title added in v0.1.0

func (ta *TextArea) Title() string

func (*TextArea) Update

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

func (*TextArea) Value

func (ta *TextArea) Value() string

type TextInput

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

func NewTextInput

func NewTextInput(formItem types.FormInput) *TextInput

func (*TextInput) Height

func (ti *TextInput) Height() int

func (*TextInput) SetHidden added in v0.1.0

func (ti *TextInput) SetHidden()

func (*TextInput) SetWidth

func (ti *TextInput) SetWidth(width int)

func (*TextInput) Title added in v0.1.0

func (ti *TextInput) Title() string

func (*TextInput) Update

func (ti *TextInput) Update(msg tea.Msg) (FormInput, tea.Cmd)

func (*TextInput) Value

func (ti *TextInput) Value() string

func (TextInput) View

func (ti TextInput) View() string

type UpdateQueryMsg added in v0.1.0

type UpdateQueryMsg struct {
	Query string
}

Jump to

Keyboard shortcuts

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