Documentation ¶
Index ¶
- Constants
- type Item
- type LangTxt
- type Menu
- func (m *Menu) Add(name, note string, tag any, act func(*Item) error)
- func (m *Menu) AddItem(i ...Item)
- func (m *Menu) Run() (*Item, error)
- func (m *Menu) SetDelimiter(s string)
- func (m *Menu) SetIndex(si bool)
- func (m *Menu) SetMessage(msg string)
- func (m *Menu) SetPagesize(n int)
- func (m *Menu) SetSelectIcon(p string)
- func (m *Menu) SetSelectedColor(c int)deprecated
- func (m *Menu) SetSelectedStyle(styles ...string)
- func (m *Menu) Seti18n(cur, page, help string)
- func (m *Menu) Sort(s func(i, j *Item) bool)
Constants ¶
View Source
const ( Color_min = 30 + iota Color_Red Color_Green Color_Yellow Color_Blue Color_max )
View Source
const ( Style_Reverse = "\033[7m" Style_Black = "\033[30;1m" Style_Red = "\033[31;1m" Style_Green = "\033[32;1m" Style_Yellow = "\033[33;1m" Style_Blue = "\033[34;1m" Style_Purple = "\033[35;1m" Style_Cyan = "\033[36;1m" Style_White = "\033[37;1m" Style_Black_bg = "\033[40m" Style_Red_bg = "\033[41m" Style_Green_bg = "\033[42m" Style_Yellow_bg = "\033[43m" Style_Blue_bg = "\033[44m" Style_Purple_bg = "\033[45m" Style_Cyan_bg = "\033[46m" Style_White_bg = "\033[47m" )
View Source
const ( KEY_ignore = iota KEY_up KEY_down KEY_left KEY_right KEY_escape KEY_enter KEY_ctrlC KEY_backspace KEY_pageup KEY_pagedown KEY_filterstring )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct { Name string // Menu item name, first item displayed Note string // Menu item description, second item displayed Tags any // Attached data Act func(*Item) error // The execution function of menu items. The function parameter is a menu item // contains filtered or unexported fields }
type Menu ¶
type Menu struct { // contains filtered or unexported fields } // Menu structure
func (*Menu) Add ¶
Add menu item
tag - Attached parameter; act - Execute function, function parameter is menu item
func (*Menu) Run ¶
Run menu, loop endlessly. Exit after selecting a menu item and executing it, or interrupt with CtrlC. Returns the currently selected menu item.
func (*Menu) SetPagesize ¶
Set the number of menu items displayed per page
func (*Menu) SetSelectIcon ¶
Set the indicator for the current selection to be at the front of the menu
func (*Menu) SetSelectedColor
deprecated
func (*Menu) SetSelectedStyle ¶ added in v1.0.1
Set selected item style. Use regular expression `^\033\[[\d;]+m$` to check.
Click to show internal directories.
Click to hide internal directories.