ui

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2017 License: AGPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field added in v0.16.0

type Field interface {
	GetKey() string        // Key for the data map.
	GetLabel() string      // Label to print as the prompt.
	GetLabelExtra() string // Extra info for the label, eg. defaults.

	// Sanitize user input and return the field's native type.
	Clean(s string) (interface{}, error)
}

A Field in a form.

type Form added in v0.16.0

type Form struct {
	Banner string
	Fields []Field
}

A Form used to handle user interactions.

func (Form) Run added in v0.16.0

func (f Form) Run(r io.Reader, w io.Writer) (map[string]interface{}, error)

Runs the form against the specified input and output.

type ProgressBar

type ProgressBar struct {
	Width    int
	Progress float64
}

func (ProgressBar) String

func (b ProgressBar) String() string

type StringField added in v0.16.0

type StringField struct {
	Key     string
	Label   string
	Default string

	// Length constraints.
	Min, Max int
}

func (StringField) Clean added in v0.16.0

func (f StringField) Clean(s string) (interface{}, error)

func (StringField) GetKey added in v0.16.0

func (f StringField) GetKey() string

func (StringField) GetLabel added in v0.16.0

func (f StringField) GetLabel() string

func (StringField) GetLabelExtra added in v0.16.0

func (f StringField) GetLabelExtra() string

Jump to

Keyboard shortcuts

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