uiutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UpCommand = &MenuCompleter{
		Suggestion: &prompt.Suggest{
			Text:        "..",
			Description: "move to the Parent menu",
		},
	}
	HelpCommand = &MenuCompleter{
		Suggestion: &prompt.Suggest{
			Text:        "help",
			Description: "show the help for the current menu",
		},
	}
	ExitCommand = &MenuCompleter{
		Suggestion: &prompt.Suggest{
			Text:        "exit",
			Description: "exit the interactive console",
		},
	}
	TailCommands = []*MenuCompleter{UpCommand, HelpCommand, ExitCommand}
)

Functions

func InputAmount

func InputAmount(pr string) (types.Amount, bool)

func InputFilename

func InputFilename(pr string, rootPath string, mustExit bool) (string, error)

func InputIntWithDefault

func InputIntWithDefault(pr string, def int) (int, bool)

func InputMultiChoice

func InputMultiChoice(pr string, def string, choices []prompt.Suggest, helpFunc func(c []prompt.Suggest)) (string, bool)

func InputSandboxedFilename

func InputSandboxedFilename(pr string, rootPath string, mustExist bool) (string, error)

func InputText

func InputText(pr string) string

func InputTextWithDefault

func InputTextWithDefault(pr, def string) string

func InputYesNo

func InputYesNo(pr string, def bool) (bool, bool)

Types

type MenuCompleter struct {
	Suggestion *prompt.Suggest
	Sub        []*MenuCompleter
	Parent     *MenuCompleter
}

func NewMenuCompleter

func NewMenuCompleter(cmd *cobra.Command, parent *MenuCompleter) *MenuCompleter

func NewRootNode

func NewRootNode(entries []*MenuCompleter) *MenuCompleter
func (cc *MenuCompleter) Completer(doc prompt.Document) []prompt.Suggest
func (cc *MenuCompleter) Name() string
func (cc *MenuCompleter) Prompt(p string) string

Jump to

Keyboard shortcuts

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