Documentation
¶
Index ¶
- func Bold(s string) string
- func BoldColor(c UIColor, s string) string
- func Color(c UIColor, s string) string
- func Error(format string, args ...interface{})
- func Faint(s string) string
- func Hint(str string, noPadding bool, label *string)
- func Info(format string, args ...interface{})
- func Init(preferences *prefs.Preferences)
- func Line(format string, a ...interface{})
- func LineIndent(indent int, format string, a ...interface{})
- func Progress(str string)
- func Warn(format string, args ...interface{})
- type UI
- func (u *UI) Bold(s string) string
- func (u *UI) BoldColor(c UIColor, s string) string
- func (u *UI) Child(indent int) *UI
- func (u *UI) Color(c UIColor, s string) string
- func (u *UI) Error(format string, args ...interface{})
- func (u *UI) Faint(s string) string
- func (u *UI) Hint(str string, noPadding bool, label *string)
- func (u *UI) Info(format string, args ...interface{})
- func (u *UI) Line(format string, a ...interface{})
- func (u *UI) LineIndent(indent int, format string, a ...interface{})
- func (u *UI) Progress(str string)
- func (u *UI) Warn(format string, args ...interface{})
- func (u *UI) Write(p []byte) (n int, err error)
- type UIColor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶ added in v0.28.1
func Error(format string, args ...interface{})
Error calls Error on the default UI
func Info ¶ added in v0.28.1
func Info(format string, args ...interface{})
Info calls Info 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
LineIndent calls LineIndent 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
// EnableColors is whether formatted text should be colored
EnableColors bool
}
UI exposes methods for creating a terminal ui
func (*UI) Child ¶ added in v0.23.0
Child returns a new UI, with settings from the receiver UI, and Indent increased by the provided value.
func (*UI) Error ¶ added in v0.28.1
Error handles outputting error information to the user such as the fact they couldn't log in due to an error.
The error is printed out to stderr if stdout is not attached to a termainl
func (*UI) Hint ¶ added in v0.23.0
Hint handles the ui output for hint/onboarding messages, when enabled
func (*UI) Info ¶ added in v0.28.1
Info handles outputting secondary information to the user such as messages about progress but are the actual result of an operation. For example, printing out that we're attempting to log a user in using the specific environment variables.
Only printed if stdout is attached to a terminal.
func (*UI) Line ¶ added in v0.23.0
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
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
Progress handles the ui output for progress events, when enabled