lib

package
v0.0.0-...-dbd7cec Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CTRLC        = "\x03"
	KeyUp        = "\x1b[A"
	KeyDown      = "\x1b[B"
	KeyRight     = "\x1b[C"
	KeyLeft      = "\x1b[D"
	KeyBackspace = "\x08"
	KeyDelete    = "\x7f"
	KeyEnter     = "\r"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Menu struct {
	User *types.User
	// contains filtered or unexported fields
}

func NewMenu

func NewMenu(reader *bufio.Reader, db *db_manager.Manager, pages map[int]MenuPage) *Menu
func (m *Menu) ChangePage(pageId int) error
func (m *Menu) ClearErrorMessage()
func (m *Menu) ClearInfoMessage()
func (m *Menu) ClearLine()
func (m *Menu) ClearScreen()
func (m *Menu) DecreaseOption()
func (m *Menu) Display() error
func (m *Menu) Exit()
func (m *Menu) GetCurrentOption() (*MenuPageOption, error)
func (m *Menu) GetCurrentPage() (*MenuPage, error)
func (m *Menu) HideCursor()
func (m *Menu) IncreaseOption()
func (m *Menu) MoveCursorToTop()
func (m *Menu) PromptBoolean(message string) (*bool, error)
func (m *Menu) PromptDate(message string) (*time.Time, error)
func (m *Menu) PromptDateTime(message string) (*time.Time, error)
func (m *Menu) PromptFloat32(message string) (*float32, error)
func (m *Menu) PromptFloat64(message string) (*float64, error)
func (m *Menu) PromptInt(message string) (*int, error)
func (m *Menu) PromptInt32(message string) (*int32, error)
func (m *Menu) PromptInt64(message string) (*int64, error)
func (m *Menu) PromptPassword(message string) (*string, error)
func (m *Menu) PromptString(message string) (*string, error)
func (m *Menu) PromptStruct(target any, omitKeys []string) error
func (m *Menu) ReadKey() (string, error)
func (m *Menu) SetErrorMessage(err error)
func (m *Menu) SetInfoMessage(message string)
func (m *Menu) ShowCursor()
type MenuPage struct {
	Label          string
	Options        []MenuPageOption
	PreviousMenuId *int
}
type MenuPageOption struct {
	Id      int
	Label   string
	OnClick OnClickHandler
}

type OnClickHandler

type OnClickHandler func(menu *Menu) error

Jump to

Keyboard shortcuts

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