prompter

package
v0.0.0-...-f1ec097 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package prompter is utility for easy prompting

Index

Constants

View Source
const VERSION = "0.3.0"

VERSION version of prompter

Variables

This section is empty.

Functions

func Choose

func Choose(message string, choices []string, defaultChoice string) string

Choose make a choice

func Password

func Password(message string) string

Password asks password

func Prompt

func Prompt(message, defaultAnswer string) string

Prompt simple prompting

func Regexp

func Regexp(message string, reg *regexp.Regexp, defaultAnswer string) string

Regexp checks the answer by regexp

func YN

func YN(message string, yes bool) bool

YN y/n choice

func YesNo

func YesNo(message string, yes bool) bool

YesNo yes/no choice

Types

type Prompter

type Prompter struct {
	Message string
	// choices of answer
	Choices    []string
	IgnoreCase bool
	Default    string
	// specify answer pattern by regexp. When both Choices and Regexp are specified, Regexp takes a priority.
	Regexp *regexp.Regexp
	// for passwords and so on.
	NoEcho     bool
	UseDefault bool
	// contains filtered or unexported fields
}

Prompter is object for prompting

func (*Prompter) Prompt

func (p *Prompter) Prompt() string

Prompt displays a prompt and returns answer

Jump to

Keyboard shortcuts

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