menu

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: GPL-2.0, GPL-2.0-or-later Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMenuMissingName = errors.New("Missing menu name")
View Source
var ErrMenuMissingOpenBrace = errors.New("Missing {")
View Source
var ErrMenuNoNesting = errors.New("Nesting not allowed")
View Source
var ErrMenuNotFound = errors.New("Menu not found")
View Source
var ErrMenuOutOfRange = errors.New("Menu item out of range")
View Source
var ErrMenuUnexpectedEOL = errors.New("Unexpected end of line")
View Source
var ErrMenuUnexpectedText = errors.New("Unexpected text after }")
View Source
var InternalError = errors.New("internal error")

Functions

func New

func New() (*Command, *Command)

New() - Create a menuentry and submenu command sharing the same menu tree.

Types

type Command

type Command struct {
	C       string
	R       *Root
	Nesting bool
}

func (*Command) Apropos

func (c *Command) Apropos() lang.Alt

func (*Command) Block

func (c *Command) Block(g *goes.Goes, ls shellutils.List) (*shellutils.List,
	func(stdin io.Reader, stdout io.Writer, stderr io.Writer) error, error)

func (*Command) FindEntry

func (c *Command) FindEntry(args ...int) (e *Entry, err error)

func (*Command) FindMenu

func (c *Command) FindMenu(args ...int) (m *Menu, err error)

func (Command) Main

func (Command) Main(args ...string) error

func (*Command) Man

func (c *Command) Man() lang.Alt

func (*Command) Reset

func (c *Command) Reset()

Reset() resets a menu to be empty

func (*Command) String

func (c *Command) String() string

func (*Command) Usage

func (c *Command) Usage() string

type Entry

type Entry struct {
	Name    string
	RunFun  func(stdin io.Reader, stdout io.Writer, stderr io.Writer) error
	Submenu *Menu
}

func (*Entry) String

func (e *Entry) String() (s string)
type Menu struct {
	Entries *[]Entry // Menu entries at this level
}
func (m *Menu) NumberedMenu() (s string)

NumberedMenu() returns the indicated menu as a numbered list.

func (m *Menu) RunMenu(i int,
	stdin io.Reader,
	stdout io.Writer, stderr io.Writer) (sm *Menu, err error)
func (m *Menu) String() (s string)

type Root

type Root struct {
	RootMenu    *Menu
	CurrentMenu *Menu
}

func (*Root) String

func (r *Root) String() (s string)

Jump to

Keyboard shortcuts

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