promptui

package
v0.5.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package promptui provides ui elements for the command line prompt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prompt

type Prompt struct {
	Label string // Label is the value displayed on the command line prompt

	// Validate is optional. If set, this function is used to validate the input
	// after each character entry.
	Validate ValidateFunc

	// If mask is set, this value is displayed instead of the actual input
	// characters.
	Mask rune
	// contains filtered or unexported fields
}

Prompt represents a single line text field input.

func (*Prompt) Run

func (p *Prompt) Run() (string, error)

Run runs the prompt, returning the validated input.

type ValidateFunc

type ValidateFunc func(string) error

ValidateFunc validates the given input. It should return a ValidationError if the input is not valid.

type ValidationError

type ValidationError struct {
	// contains filtered or unexported fields
}

ValidationError is the class of errors resulting from invalid inputs, returned from a ValidateFunc.

func NewValidationError

func NewValidationError(msg string) *ValidationError

NewValidationError creates a new validation error with the given message.

func (*ValidationError) Error

func (v *ValidationError) Error() string

Error implements the error interface for ValidationError.

Jump to

Keyboard shortcuts

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