ui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FilterbyTag = false

Controls the filtering mode

Functions

func AddItemToList

func AddItemToList(inputScreen InputFormScreen) error

Adds an item to the list depending on the values of the form and writes it to config.json

func BuildHelpItem

func BuildHelpItem(title string, keys []HelpKeyBindingSpec) string

Builds the help menu for the given set of key bindings and the tile

func BuildHelpMenu

func BuildHelpMenu() string

Builds the help menu Ascii logo text and help sections with BuildHelpItem()

func BuildInputItem

func BuildInputItem(formItem InputFormSpec) string

BuildInputItem renders a single form item

func BuildInputMenu

func BuildInputMenu(formItems []InputFormSpec) string

BuildInputMenu renders the entire form screen

func ConvertItemWrappers

func ConvertItemWrappers(wrappers []config.ItemWrapper) []list.Item

ConverItemWrappers converts []ItemWrapper to []list.Item

func ConvertListItemsToItemWrappers

func ConvertListItemsToItemWrappers(items []list.Item) []config.ItemWrapper

Convert []list.Item to []ItemWrapper

func HandleRemovingItem added in v0.1.1

func HandleRemovingItem(screen ItemScreen) (tea.Model, tea.Cmd)

Removes the selected item from the screen and from config.json

func InitItems

func InitItems()

Init items based on the config.json config file

Types

type HelpKeyBindingSpec

type HelpKeyBindingSpec struct {
	// Key
	Key string
	// Description
	Desc string
}

Help key specification which holds a key and its description

type HelpScreen

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

Help screen (model) Impliments tea.Model interface with : Init, Update , View

func InitializeHelpScreen

func InitializeHelpScreen() HelpScreen

Function to init a new instance of the Help screen

func (HelpScreen) Init

func (screen HelpScreen) Init() tea.Cmd

Init

func (HelpScreen) Update

func (screen HelpScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update

func (HelpScreen) View

func (screen HelpScreen) View() string

View

type InputFormScreen

type InputFormScreen struct {
	Forms      []InputFormSpec
	FocusIndex int
	CursorMode cursor.Mode
}

FormScreen Model impliments tea.Model

func InitInputFormScreen

func InitInputFormScreen() InputFormScreen

Initialize the Input Form Screen with 2 forms

func (InputFormScreen) Init

func (screen InputFormScreen) Init() tea.Cmd

Init function to initialize a blinking cursor

func (InputFormScreen) Update

func (screen InputFormScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update function to handle user input and update the model

func (InputFormScreen) View

func (screen InputFormScreen) View() string

View function to render the UI

type InputFormSpec

type InputFormSpec struct {
	Title       string
	Desc        string
	PlaceHolder string
	TextInput   textinput.Model
}

type Item

type Item struct {
	Title string `json:"title"`
	Tag   string `json:"tag"`
}

impliments list.Item interface : FilterValue()

func (Item) FilterValue

func (item Item) FilterValue() string

The value the fuzzy filter , filters by

type ItemDelegate

type ItemDelegate struct{}

func (ItemDelegate) Height

func (delegate ItemDelegate) Height() int

func (ItemDelegate) Render

func (d ItemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item)

Render

func (ItemDelegate) Spacing

func (delegate ItemDelegate) Spacing() int

Spacing

func (ItemDelegate) Update

func (d ItemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd

Update

type ItemScreen

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

Model for the select screen

Impliments the tea.Model interface : Init() Update() View()

func InitItemScreen

func InitItemScreen() ItemScreen

func (ItemScreen) Init

func (screen ItemScreen) Init() tea.Cmd

func (ItemScreen) Update

func (screen ItemScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ItemScreen) View

func (screen ItemScreen) View() string

View

type TableScreen added in v0.1.1

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

func InitTableScreen added in v0.1.1

func InitTableScreen() TableScreen

func (TableScreen) Init added in v0.1.1

func (screen TableScreen) Init() tea.Cmd

func (TableScreen) Update added in v0.1.1

func (screen TableScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (TableScreen) View added in v0.1.1

func (screen TableScreen) View() string

Jump to

Keyboard shortcuts

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