app

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMenu

func AddMenu(menuType cmd.KeyContext)

AddMenu adds a menu to the menubar.

func DrawMenu

func DrawMenu(x int, region string)

DrawMenu renders the menu.

func FocusMenu

func FocusMenu()

FocusMenu activates the menu bar.

func FocusedTable

func FocusedTable() *tview.Table

FocusedTable returns the currently focused table.

func FocusedTableReference

func FocusedTableReference() (inv.SearchData, error)

FocusedTableReference returns the currently selected entry's information from the focused table.

func GetCurrentTab

func GetCurrentTab() string

GetCurrentTab returns the currently selected tab.

func HorizontalLine

func HorizontalLine() *tview.Box

HorizontalLine returns a box with a thick horizontal line.

func InitMenu

func InitMenu(data *MenuData)

InitMenu initializes the menu.

func MenuExit()

MenuExit closes the menu.

func MenuHighlightHandler(added, removed, remaining []string)

MenuHighlightHandler draws the menu based on which menu name is highlighted.

func MenuKeybindings(event *tcell.EventKey) *tcell.EventKey

MenuKeybindings describes the menu keybindings.

func ModifyReference

func ModifyReference(title string, add bool, info ...inv.SearchData) error

ModifyReference modifies the currently selected entry within the focused table.

func ResizeModal

func ResizeModal()

ResizeModal resizes the modal according to the current screen dimensions.

func SelectTab

func SelectTab(tab string)

SelectTab selects a tab.

func SetContextMenu

func SetContextMenu(menuType cmd.KeyContext, item tview.Primitive)

SetContextMenu sets the context menu.

func SetGlobalKeybindings

func SetGlobalKeybindings(kb func(event *tcell.EventKey) *tcell.EventKey)

SetGlobalKeybindings sets the keybindings for the app.

func SetPrimaryFocus

func SetPrimaryFocus()

SetPrimaryFocus sets the focus to the appropriate primitive.

func SetResizeHandler

func SetResizeHandler(resize func(screen tcell.Screen))

SetResizeHandler sets the resize handler for the app.

func SetTab

func SetTab(tabInfo Tab)

SetTab sets the tab.

func Setup

func Setup()

Setup sets up the application

func ShowError

func ShowError(err error)

ShowError shows an error message.

func ShowInfo

func ShowInfo(text string, persist bool, print ...bool)

ShowInfo shows an information message.

func Stop

func Stop(skip ...struct{})

Stop stops the application.

func SwitchTab

func SwitchTab(reverse bool, tabs ...Tab) string

SwitchTab handles the tab selection. If reverse is set, the previous tab is selected and vice-versa.

func VerticalLine

func VerticalLine() *tview.Box

VerticalLine returns a box with a thick vertical line.

Types

type Application

type Application struct {
	MenuLayout *tview.Flex
	Menu, Tabs *tview.TextView

	Area           *tview.Pages
	Pages          *tview.Pages
	Layout, Region *tview.Flex

	Status      Status
	FileBrowser FileBrowser

	SelectedStyle tcell.Style
	ColumnStyle   tcell.Style

	Suspend bool
	Closed  chan struct{}

	*tview.Application
	// contains filtered or unexported fields
}

Application describes the layout of the app.

var UI Application

UI stores the application data.

type FileBrowser

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

FileBrowser describes the layout of a file browser.

func (*FileBrowser) Hide

func (f *FileBrowser) Hide()

Hide hides the file browser.

func (*FileBrowser) Keybindings

func (f *FileBrowser) Keybindings(event *tcell.EventKey) *tcell.EventKey

Keybindings define the keybindings for the file browser.

func (*FileBrowser) Query

func (f *FileBrowser) Query(
	prompt string,
	validate func(text string, reply chan string),
	max ...int,
) string

Query displays a confirmation message within the file browser.

func (*FileBrowser) SaveFile added in v0.3.6

func (f *FileBrowser) SaveFile(
	file string,
	entriesFunc func(appendToFile bool) (string, error),
)

SaveFile saves the generated entries into a file.

func (*FileBrowser) Show

func (f *FileBrowser) Show(prompt string, dofunc func(text string), options ...FileBrowserOptions)

Show displays the file browser.

type FileBrowserOptions added in v0.3.3

type FileBrowserOptions struct {
	ShowDirOnly bool
	SetDir      string
}

FileBrowserOptions describes the file browser options.

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

MenuArea stores the menu modal and the current context menu.

type MenuData struct {
	Visible map[cmd.Key]func(menuType string) bool
	Items   map[cmd.KeyContext][]cmd.Key
}

MenuData stores the menu items and handlers.

type Modal struct {
	Name          string
	Open          bool
	Height, Width int

	Flex  *tview.Flex
	Table *tview.Table
	// contains filtered or unexported fields
}

Modal stores a layout to display a floating modal.

func NewMenuModal

func NewMenuModal(name string, regionX, regionY int) *Modal

NewMenuModal returns a menu modal.

func NewModal

func NewModal(name, title string, item tview.Primitive, height, width int) *Modal

NewModal returns a modal. If a primitive is not provided, a table is attach to it.

func (*Modal) Exit

func (m *Modal) Exit(focusInput bool)

Exit exits the modal.

func (*Modal) Show

func (m *Modal) Show(attachToStatus bool)

Show shows the modal. If attachToStatus is true, the modal will attach to the top part of the status bar rather than float in the middle.

type Status

type Status struct {
	Message *tview.TextView

	Cancel context.CancelFunc

	*tview.Pages
	*tview.InputField
	// contains filtered or unexported fields
}

Status describes the layout for a status bar

func (*Status) ErrorMessage

func (s *Status) ErrorMessage(err error)

ErrorMessage sends an error message to the status bar.

func (*Status) InfoMessage

func (s *Status) InfoMessage(text string, persist bool)

InfoMessage sends an info message to the status bar.

func (*Status) InitializingTag added in v0.3.6

func (s *Status) InitializingTag(set ...bool) (string, bool)

InitializingTag sets the buffering tag within the status bar.

func (*Status) SetFocusFunc

func (s *Status) SetFocusFunc(focus ...func())

SetFocusFunc sets the function to be executed when the input is focused.

func (*Status) SetInput

func (s *Status) SetInput(label string,
	max int,
	clearInput bool,
	dofunc func(text string),
	ifunc func(event *tcell.EventKey) *tcell.EventKey,
	chgfunc ...func(text string),
)

SetInput sets up the prompt and appropriate handlers for the input area within the status bar.

func (*Status) Setup

func (s *Status) Setup()

Setup sets up the status bar.

type Tab

type Tab struct {
	Title, Selected string
	Info            []TabInfo
}

Tab describes the layout for a tab.

type TabInfo

type TabInfo struct {
	ID, Title string
}

TabInfo stores the tab information.

Jump to

Keyboard shortcuts

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