dialog

package
v0.0.0-...-56ad08b Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialog

type Dialog struct {
	// The text of the choices, one per string.
	Choices []string
	// The question.
	Question string
}

Dialog represents a text-based multiple-choice dialog.

func (*Dialog) AddChoices

func (d *Dialog) AddChoices(c []string)

AddChoice adds the input string as a choice to the dialog.

func (Dialog) Display

func (d Dialog) Display()

Display print the dialog to os.Stdout.

func (Dialog) Render

func (d Dialog) Render() string

Render returns a string that can be printed to display the dialog.

func (Dialog) Start

func (d Dialog) Start() int

Start prints the dialog to command line and reads user input. It will return user's choice if valid, if not valid, it will keep retrying.

Jump to

Keyboard shortcuts

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