Documentation
¶
Index ¶
- Constants
- func Bold(text string) string
- func Bright(text string) string
- func Chevron() string
- func CommandText(text string) string
- func Commandf(command string, isPrimary bool) string
- func Darken(text string) string
- func Emoji(alias string) string
- func Error(text string) string
- func ExampleCommandsf(commands []ExampleCommand) string
- func ExampleTemplatef(template string) string
- func Faint(text string) string
- func Gray(text string) string
- func Green(text string) string
- func Header(text string) string
- func Highlight(text string) string
- func HomePath(filepath string) string
- func Indent(text string) string
- func Input(text string) string
- func IsLipglossEnabled() bool
- func LinkText(path string) string
- func LocalRunDisplayName(name string) string
- func Mapf(m map[string]string) string
- func Pluralize(singular string, plural string, count int) string
- func PrintTemplate(w io.Writer, tmpl string, data any) (err error)
- func Red(text string) string
- func RemoveANSI(str string) string
- func RemoveEmoji(str string) string
- func Secondary(text string) string
- func SectionHeaderf(emoji, text string) string
- func SectionSecondaryf(format string, a ...interface{}) string
- func Sectionf(section TextSection) string
- func Selector(text string) string
- func Separator() string
- func StyleFlags(text string) string
- func Styler() *aurora.Aurora
- func TeamSelectLabel(teamDomain string, teamID string) string
- func ThemeSlack() huh.Theme
- func ThemeSurvey() huh.Theme
- func TimeAgo(datetime int) string
- func ToggleLipgloss(active bool)
- func ToggleSpinner(spins bool)
- func ToggleStyles(active bool)
- func Tracef(traceID string, traceValues ...string) string
- func Underline(text string) string
- func Warning(text string) string
- func Yellow(text string) string
- type ExampleCommand
- type Spinner
- type TemplateData
- type TextSection
Constants ¶
const LocalRunNameTag = "(local)"
Variables ¶
This section is empty.
Functions ¶
func Chevron ¶
func Chevron() string
Chevron returns the select chevron character for the current platform. Unfortunately "❱" does not display on Windows Powershell. Limit "❱" to non-Windows until support is known for other operating systems.
func Commandf ¶
TODO: this is reusing logic from process.go, but can't import because of circular dependencies
func ExampleCommandsf ¶
func ExampleCommandsf(commands []ExampleCommand) string
ExampleCommandsf returns a multiline string of commands and comments
func ExampleTemplatef ¶
ExampleTemplatef indents and styles command examples for the help messages
func IsLipglossEnabled ¶
func IsLipglossEnabled() bool
IsLipglossEnabled reports whether lipgloss styling is active
func LocalRunDisplayName ¶
LocalRunDisplayName appends the (local) tag to apps created by the run command
func PrintTemplate ¶
PrintTemplate outputs the template with data to the writer or errors
Note: Templates use the Go standard library template package https://pkg.go.dev/text/template
func RemoveANSI ¶
RemoveANSI uses regex to strip ANSI colour codes
Shamelessly stolen from https://github.com/acarl005/stripansi/blob/master/stripansi.go
func RemoveEmoji ¶
RemoveEmoji strips non-ASCII characters (such as emoji) from a string and collapses any resulting extra whitespace.
https://en.wikipedia.org/wiki/ASCII#Printable_character_table
func SectionHeaderf ¶
SectionHeaderf returns a standard formatted section header TODO - support the the arg text ...string to do formatting
func SectionSecondaryf ¶
SectionSecondaryf returns a standard formatted section secondary text
func StyleFlags ¶
StyleFlags post-processes Cobra's FlagUsages() output to colorize flag names and descriptions.
func Styler ¶
DEPRECATED: Styler returns an aurora instance for legacy styling. Use the style functions (Secondary, CommandText, Error, etc.) instead.
func TeamSelectLabel ¶
TeamSelectLabel formats a team label with the teamID
func ThemeSlack ¶
ThemeSlack returns a huh Theme styled with Slack brand colors.
func ThemeSurvey ¶
ThemeSurvey returns a huh Theme that matches the legacy survey prompt styling. Applied when experiment.Lipgloss is off.
func ToggleLipgloss ¶
func ToggleLipgloss(active bool)
ToggleLipgloss enables lipgloss-based styling when set to true
func ToggleSpinner ¶
func ToggleSpinner(spins bool)
ToggleSpinner enables the animation when spins is true, otherwise disables it
func ToggleStyles ¶
func ToggleStyles(active bool)
ToggleStyles sets styles and formatting values to the active state
Types ¶
type ExampleCommand ¶
type ExampleCommand struct {
// Command is the command to be run, not including the process name
Command string
// Meaning plainly describes the result of running the command
Meaning string
}
ExampleCommand contains a command with a descriptive meaning
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner is a stylized object to indicate loading text
func NewSpinner ¶
NewSpinner creates a spinner that will write to writer
type TemplateData ¶
type TemplateData map[string]interface{}
TemplateData contains any optional values to include in the formatted message
Note: A custom template function should also be added for custom values