imnu

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 6 Imported by: 0

README

Interactive Menu

Provides framework for an interactive menu system on the commandline

EXAMPLE:

menu = imnu.New(menuDisplaySelections, []imnu.Menu{ {Id: 1, Name: "List xxx", Description: "Lists xxx", Enable: func() bool { return true }, Task: func() { ID = listXXX() }}, {Id: 2, Name: "List yyy", Description: "List yyy", Enable: func() bool { return len(ID) > 0 }, Task: func() { yyyID = listYYY() }}, {Id: 999, Name: "Quit", Description: "Quit program", Task: func() { log.Println("Exiting.."); os.Exit(0) }}, }) menu.StartMenu()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureSelection

func CaptureSelection(datamap map[string]string, msg ...string) []string

func Pause

func Pause()

Types

type InteractiveMenu

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

func New

func New(displaySelections interface{}, menulayout []Menu) *InteractiveMenu

Flow

  1. Show menu with options to enter
  2. User pushes # and enter
  3. System performs and outputs data on screen with option to choose what to do next

func (*InteractiveMenu) SetMsg

func (i *InteractiveMenu) SetMsg(msg string)

func (*InteractiveMenu) StartMenu

func (i *InteractiveMenu) StartMenu()
type Menu struct {
	Id          int
	Name        string
	Description string
	Enable      interface{}
	Task        interface{}
}

Jump to

Keyboard shortcuts

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