ui

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2017 License: BSD-3-Clause Imports: 7 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hint

func Hint(str string, noPadding bool, label *string)

Hint calls hint on the default UI

func Init

func Init(preferences *prefs.Preferences)

Init initializes a default global UI, accessible via the package functions.

func Line added in v0.23.0

func Line(format string, a ...interface{})

Line calls Line on the default UI

func LineIndent added in v0.23.0

func LineIndent(indent int, format string, a ...interface{})

LineIndent calls LineIndent on the default UI

func Progress

func Progress(str string)

Progress calls Progress on the default UI

Types

type UI added in v0.23.0

type UI struct {
	Indent int

	// Cols holds the column width for text wrapping. For the default UI and
	// its children, It is either the width of the  terminal, or defaultCols,
	// minus rightPad.
	Cols int

	// EnableProgress is whether progress events should be displayed
	EnableProgress bool

	// EnableHints is whether hints should be displayed
	EnableHints bool
}

UI exposes methods for creating a terminal ui

func Child added in v0.23.0

func Child(indent int) *UI

Child calls Child on the default UI

func (*UI) Child added in v0.23.0

func (u *UI) Child(indent int) *UI

Child returns a new UI, with settings from the receiver UI, and Indent increased by the provided value.

func (*UI) Hint added in v0.23.0

func (u *UI) Hint(str string, noPadding bool, label *string)

Hint handles the ui output for hint/onboarding messages, when enabled

func (*UI) Line added in v0.23.0

func (u *UI) Line(format string, a ...interface{})

Line writes a formatted string followed by a newline to stdout. Output is word wrapped, and terminated by a newline.

func (*UI) LineIndent added in v0.23.0

func (u *UI) LineIndent(indent int, format string, a ...interface{})

LineIndent writes a formatted string followed by a newline to stdout. Output is word wrapped, and terminated by a newline. All lines after the first are indented by indent number of spaces (in addition to the indenting enforced by this UI instance.

func (*UI) Progress added in v0.23.0

func (u *UI) Progress(str string)

Progress handles the ui output for progress events, when enabled

func (*UI) Write added in v0.23.0

func (u *UI) Write(p []byte) (n int, err error)

Write implements the io.Writer interface The provided bytes are split on newlines, and written with the UI's configured indent.

Jump to

Keyboard shortcuts

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