menu

package
v0.0.0-...-cb3607a Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

a simple dmenu Menu implementation

package menu gives interfaces for integrating menu programs such as dmenu into a go program

provides basic dmenu and ui implementations

Index

Constants

This section is empty.

Variables

View Source
var AlrRan = errors.New("Already Ran")
View Source
var Escaped = errors.New("User made no selection")
View Source
var NotInstalled = errors.New("Dmenu not installed")

errors

Functions

This section is empty.

Types

type Map

type Map map[string][2]interface{}

used for keeping track of ui.Menu's while keeping the mass amount of potential the ui package has

type Menu interface {
	// pass is whether or not the prompt should
	// be password protected.
	Prompt(pass bool) error // prompts the user
	Bytes() []byte          // bytes returned, if any
	Ran() bool              // if the user has been prompted
	Error() error           // returns the error, if any.

	Map() Map // can be nil for other use cases
}

this is supposed to be use once like exec.Cmd

a reuseable interface would be more complex. though it might be better for some projects, it isn't for this one.

func NewDmenu

func NewDmenu(items string, flags []string, passFlag string, mapp Map) (Menu, error)

items seperated by '\n'

mapp can be nil and passFlag can be an empty string if not patched

mapp can be nil

func NewSlicedDmenu

func NewSlicedDmenu(items, flags []string, passFlag string, mapp Map) (Menu, error)

like NewDmenu but takes []string for items rather than a string seperated by '\n'

mapp can be nil

Jump to

Keyboard shortcuts

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