Documentation ¶
Index ¶
- func Attached() bool
- func BoldColorString(c Color, s string) string
- func BoldString(s string) string
- func ColorString(c Color, s string) string
- func Error(format string, args ...interface{})
- func FaintString(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 Warn(format string, args ...interface{})
- type Color
- type Spinner
- type UI
- func (u *UI) BoldColorString(c Color, s string) string
- func (u *UI) BoldString(s string) string
- func (u *UI) Child(indent int) *UI
- func (u *UI) ColorString(c Color, s string) string
- func (u *UI) Error(format string, args ...interface{})
- func (u *UI) FaintString(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) NewSpinner(text string) *Spinner
- func (u *UI) Warn(format string, args ...interface{})
- func (u *UI) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attached ¶ added in v0.30.0
func Attached() bool
Attached return a boolean representing whether or not the current session is attached to a terminal or not.
func BoldColorString ¶ added in v0.30.0
BoldColorString returns a bolded, colored copy of the string (ANSI escape sequenced)
func BoldString ¶ added in v0.30.0
BoldString returns a bolded copy of the string (ANSI escape sequenced)
func ColorString ¶ added in v0.30.0
ColorString returns the original string, converted to the provided ANSI color
func Error ¶ added in v0.28.1
func Error(format string, args ...interface{})
Error calls Error on the default UI
func FaintString ¶ added in v0.30.0
FaintString returns a faint (ANSI DarkGray) copy of the string (ANSI escape sequenced)
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 Color ¶ added in v0.29.0
type Color int
Color represents 1 of 16 ANSI color sequences
const ( // Default sets the temrinal text to its default color Default Color // Black text Black // Red text Red //Green text Green // Yellow text Yellow // Blue text Blue // Magenta text Magenta // Cyan text Cyan // Gray text Gray // DarkGray text DarkGray // BrightRed text BrightRed // BrightGreen text BrightGreen // BrightYellow text BrightYellow // BrightBlue text BrightBlue // BrightMagenta text BrightMagenta // BrightCyan text BrightCyan // White text White )
type Spinner ¶ added in v0.30.0
type Spinner struct {
// contains filtered or unexported fields
}
Spinner struct contains the spinner struct and display text
func NewSpinner ¶ added in v0.30.0
NewSpinner calls NewSpinner on the default UI
func (*Spinner) Start ¶ added in v0.30.0
func (s *Spinner) Start()
Start displays the Spinner and starts movement
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) BoldColorString ¶ added in v0.30.0
BoldColorString checks the EnableColors pref and returns a bolded, colored copy of the string (ANSI escape sequenced)
func (*UI) BoldString ¶ added in v0.30.0
BoldString checks the EnableColors pref and returns a bolded copy of the string (ANSI escape sequenced)
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) ColorString ¶ added in v0.30.0
ColorString checks the EnableColors pref and returns a colored copy of the string (ANSI escape sequenced)
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) FaintString ¶ added in v0.30.0
FaintString checks the EnableColors pref and returns a faint (ANSI DarkGrey) copy of the string (ANSI escape sequenced)
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) NewSpinner ¶ added in v0.30.0
NewSpinner creates a new ui.Spinner struct (spinner.go)