ui

package
v0.0.0-...-479f5f5 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UI

type UI interface {
	AskForText(label string) (string, error)
	AskForFloat(label string) (float64, error)
	AskForInt(label string) (int, error)

	PrintLinef(pattern string, args ...interface{})
	SystemLinef(pattern string, args ...interface{})
	ErrorLinef(pattern string, args ...interface{})

	Printf(pattern string, args ...interface{})
	Systemf(pattern string, args ...interface{})
	Errorf(pattern string, args ...interface{})

	DisplayColumns(items []string, columns int)

	SetMaxInvalidInput(value int)
}

UI ...

type WriterUI

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

WriterUI Writer UI type

func NewConsoleUI

func NewConsoleUI() *WriterUI

NewConsoleUI creates an instance of the WriterUI

func NewWriterUI

func NewWriterUI(outWriter, errWriter io.Writer, inReader io.Reader) *WriterUI

NewWriterUI creates a UI instance

func (*WriterUI) AskForFloat

func (w *WriterUI) AskForFloat(label string) (float64, error)

AskForFloat requests a float value via stdin from the user

func (*WriterUI) AskForInt

func (w *WriterUI) AskForInt(label string) (int, error)

AskForInt requests a int value via stdin from the user

func (*WriterUI) AskForText

func (w *WriterUI) AskForText(label string) (string, error)

AskForText requests input via stdin from the user

func (*WriterUI) DisplayColumns

func (w *WriterUI) DisplayColumns(items []string, columns int)

DisplayColumns prints to stdout the items by columns

func (*WriterUI) ErrorLinef

func (w *WriterUI) ErrorLinef(pattern string, args ...interface{})

ErrorLinef requests input via stdin from the user

func (*WriterUI) Errorf

func (w *WriterUI) Errorf(pattern string, args ...interface{})

Errorf requests input via stdin from the user

func (*WriterUI) PrintLinef

func (w *WriterUI) PrintLinef(pattern string, args ...interface{})

PrintLinef requests input via stdin from the user

func (*WriterUI) Printf

func (w *WriterUI) Printf(pattern string, args ...interface{})

Printf requests input via stdin from the user

func (*WriterUI) SetMaxInvalidInput

func (w *WriterUI) SetMaxInvalidInput(value int)

SetMaxInvalidInput overrides the max invalid input variable

func (*WriterUI) SystemLinef

func (w *WriterUI) SystemLinef(pattern string, args ...interface{})

SystemLinef requests input via stdin from the user

func (*WriterUI) Systemf

func (w *WriterUI) Systemf(pattern string, args ...interface{})

Systemf requests input via stdin from the user

Jump to

Keyboard shortcuts

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