ui

package
v0.89.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Color string

Color represents the coloring mode.

Functions

func FormatTable added in v0.11.0

func FormatTable(t table.Table)

FormatTable formats the table.

Types

type ColorFormatter

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

ColorFormatter is a string formatter with color.

func (*ColorFormatter) Bold

func (c *ColorFormatter) Bold(s string) string

Bold returns bold decorated string.

func (*ColorFormatter) Cyan

func (c *ColorFormatter) Cyan(s string) string

Cyan returns cyan-colored string.

func (*ColorFormatter) Green

func (c *ColorFormatter) Green(s string) string

Green returns green-colored string.

func (*ColorFormatter) GreenBg

func (c *ColorFormatter) GreenBg(s string) string

GreenBg returns string with green background.

func (*ColorFormatter) Red

func (c *ColorFormatter) Red(s string) string

Red returns red-colored string.

func (*ColorFormatter) RedBg

func (c *ColorFormatter) RedBg(s string) string

RedBg returns string with red background.

func (*ColorFormatter) Yellow

func (c *ColorFormatter) Yellow(s string) string

Yellow returns yellow-colored string.

type ColorMode

type ColorMode string

ColorMode represents coloring mode for the prompt.

const (
	// ColorAuto indicates the coloring is turned on/off according to the terminal settings.
	ColorAuto ColorMode = "auto"
	// ColorAlways indicates the output is always colored.
	ColorAlways ColorMode = "always"
	// ColorNever indicates the output is never colored.
	ColorNever ColorMode = "never"
)

type Prompter

type Prompter interface {
	Ask(q survey.Prompt, response interface{}, opts ...survey.AskOpt) error

	Printf(format string, a ...any)
	Println(a ...any)
	Warn(msg string)
	Error(msg string)
	Done(msg string)

	StartSpinner(msg string, newline bool) *spinner.Spinner
	ColorFormatter() *ColorFormatter
}

Prompter is an interface that provides functions for the prompt.

func NewPrompter

func NewPrompter() Prompter

NewPrompter returns a new Prompter.

Jump to

Keyboard shortcuts

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