dilemma

package module
v0.0.0-...-083b5a5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2016 License: MIT Imports: 3 Imported by: 1

README

asciicast

Documentation

Overview

Package dilemma allows creating a TTY selection prompt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Title   string
	Options []string
	Help    string
}

Config holds the configuration to display a list of options for a user to select.

type Key

type Key int

Key represents keys pressed by the user.

const (
	// Empty means key code information is not applicable
	Empty Key = iota

	// CtrlC means CTRL-C was pressed.
	// Usually this means the user wants to send SIGINT.
	CtrlC
)

func Prompt

func Prompt(config Config) (string, Key, error)

Prompt asks the user to select an option from the list. The selected option is returned in the first return value. The second return value is set to Empty unless the user presses CTRL-C (indicating she wants to signal SIGINT) in which case the value will be CtrlC.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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