ui

package
v0.0.0-...-6be9b1d Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interactor

type Interactor interface {
	Wait() error
	Edit([]byte) ([]byte, error)
	Display(...interface{})
	Displayf(string, ...interface{})
	Displayln(...interface{})
	Read() (string, error)
	ReadPassword() (string, error)
	SetLocation(*time.Location)
	Location() *time.Location
}

Interactor is the interface that allows input/output from/to the user

type Terminal

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

Terminal allows command-line interaction with the user

func NewTerminal

func NewTerminal(e string, l *time.Location) *Terminal

NewTerminal returns a new terminal instance with the provided editor

func (*Terminal) Display

func (t *Terminal) Display(a ...interface{})

Display displays a string

func (*Terminal) Displayf

func (t *Terminal) Displayf(c string, a ...interface{})

Displayf displays an interpolated string

func (*Terminal) Displayln

func (t *Terminal) Displayln(a ...interface{})

Displayln displays a string followed by a carriage return

func (*Terminal) Edit

func (t *Terminal) Edit(og []byte) ([]byte, error)

Edit opens contents in an editor and allows the user to edit them

func (*Terminal) Location

func (t *Terminal) Location() *time.Location

Location returns the user's location (to determine timezone)

func (*Terminal) Read

func (t *Terminal) Read() (string, error)

Read reads from stdin until a carriage return, then trims any whitespace

func (*Terminal) ReadPassword

func (t *Terminal) ReadPassword() (string, error)

ReadPassword reads from stdin, not displaying the results to the terminal, until a carriage return, then trims any whitespace

func (*Terminal) SetLocation

func (t *Terminal) SetLocation(l *time.Location)

SetLocation sets the client's local location

func (*Terminal) Wait

func (t *Terminal) Wait() error

Wait displays a message and waits for the user to press enter

Jump to

Keyboard shortcuts

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