menu

package
v0.0.0-...-7df0ded Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package menu fork of https://github.com/turret-io/go-menu

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandOption

type CommandOption struct {
	Description string
	Color       color.Attribute
	Function    func(args ...string) error
}

CommandOption main struct to handle options for Description, and the function that should be called

type Menu struct {
	Commands []CommandOption
	Options  Options
}

Menu struct encapsulates Commands and Options

func NewMenu

func NewMenu(cmds []CommandOption, options Options) *Menu

NewMenu creates a new menu with options

func (m *Menu) Start()

Start is a wrapper for providing Stdin to the main menu loop

type Options

type Options struct {
	Name        string
	Prompt      string
	MenuLength  int
	MenuCommand string
}

Options sets name, prompt, character width of menu, and command used to display the menu

func NewOptions

func NewOptions(name string, prompt string, length int, menuCommand string) Options

NewOptions to setup the options for the menu. An empty string for prompt and a length of 0 will use the default "> " prompt and 100 character wide menu. An empty string for menuCommand will use the default 'menu' command.

Jump to

Keyboard shortcuts

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