style

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

View Source
const SpinnerCharacter = 9

SpinnerCharacter is which of the spinner.CharSets to use

Variables ΒΆ

View Source
var (
	// LowBullet is a bullet-point prefix for Low-fi mode
	LowBullet = "* "
	// LowIndent is an indented prefix for Low-fi mode
	LowIndent = "  "
	// LowIndentBullet is an indented bullet-point prefix for Low-fi mode
	LowIndentBullet = "  - "
	// LowWarning is a warning prefix for Low-fi mode
	LowWarning = "! "
	// LowError is an error prefix for Low-fi mode
	LowError = "X "
	// Indented is how far to indent unstyled text
	Indented = "    "
)
View Source
var Config = map[Enum]Options{
	Celebration:        {Prefix: "πŸŽ‰  "},
	Check:              {Prefix: "βœ…  "},
	Command:            {Prefix: "    β–ͺ ", LowPrefix: LowIndentBullet},
	Confused:           {Prefix: "πŸ˜•  "},
	Deleted:            {Prefix: "πŸ’€  "},
	Documentation:      {Prefix: "πŸ“˜  "},
	Empty:              {Prefix: "", LowPrefix: ""},
	Happy:              {Prefix: "πŸ˜„  "},
	Issue:              {Prefix: "    β–ͺ ", LowPrefix: LowIndentBullet},
	Indent:             {Prefix: "    ", LowPrefix: LowIndent},
	Issues:             {Prefix: "🍿  "},
	Launch:             {Prefix: "πŸš€  "},
	LogEntry:           {Prefix: "    "},
	New:                {Prefix: "πŸ†•  "},
	Notice:             {Prefix: "πŸ“Œ  "},
	Option:             {Prefix: "    β–ͺ ", LowPrefix: LowIndentBullet},
	Pause:              {Prefix: "⏸️  "},
	Provisioning:       {Prefix: "🌱  "},
	Ready:              {Prefix: "πŸ„  "},
	Restarting:         {Prefix: "πŸ”„  "},
	Running:            {Prefix: "πŸƒ  "},
	Sparkle:            {Prefix: "✨  "},
	Stopped:            {Prefix: "πŸ›‘  "},
	Stopping:           {Prefix: "βœ‹  "},
	Success:            {Prefix: "βœ…  "},
	ThumbsDown:         {Prefix: "πŸ‘Ž  "},
	ThumbsUp:           {Prefix: "πŸ‘  "},
	Unpause:            {Prefix: "⏯️  "},
	URL:                {Prefix: "πŸ‘‰  ", LowPrefix: LowIndent},
	Usage:              {Prefix: "πŸ’‘  "},
	Waiting:            {Prefix: "βŒ›  "},
	WaitingWithSpinner: {Prefix: "βŒ›  ", OmitNewline: true, Spinner: true},
	Unsupported:        {Prefix: "🚑  "},
	Workaround:         {Prefix: "πŸ‘‰  ", LowPrefix: LowIndent},

	Conflict:         {Prefix: "πŸ’’  ", LowPrefix: LowWarning},
	Failure:          {Prefix: "❌  ", LowPrefix: LowError},
	Fatal:            {Prefix: "πŸ’£  ", LowPrefix: LowError},
	Warning:          {Prefix: "❗  ", LowPrefix: LowWarning},
	KnownIssue:       {Prefix: "🧯  ", LowPrefix: LowError},
	UnmetRequirement: {Prefix: "β›”  ", LowPrefix: LowError},
	NotAllowed:       {Prefix: "🚫  ", LowPrefix: LowError},
	Embarrassed:      {Prefix: "🀦  ", LowPrefix: LowWarning},
	Sad:              {Prefix: "😿  "},
	Shrug:            {Prefix: "🀷  "},
	Improvement:      {Prefix: "πŸ’¨  ", LowPrefix: LowWarning},
	SeeNoEvil:        {Prefix: "πŸ™ˆ  ", LowPrefix: LowError},

	AddonDisable:     {Prefix: "πŸŒ‘  "},
	AddonEnable:      {Prefix: "🌟  "},
	Caching:          {Prefix: "🀹  "},
	Celebrate:        {Prefix: "πŸŽ‰  "},
	Connectivity:     {Prefix: "πŸ“Ά  "},
	Containerd:       {Prefix: "πŸ“¦  "},
	ContainerRuntime: {Prefix: "🎁  "},
	Copying:          {Prefix: "✨  "},
	CRIO:             {Prefix: "🎁  "},
	DeletingHost:     {Prefix: "πŸ”₯  "},
	Docker:           {Prefix: "🐳  ", OmitNewline: true, Spinner: true},
	DryRun:           {Prefix: "🌡  "},
	Enabling:         {Prefix: "πŸ”Œ  "},
	FileDownload:     {Prefix: "πŸ’Ύ  "},
	Fileserver:       {Prefix: "πŸš€  ", OmitNewline: true},
	HealthCheck:      {Prefix: "πŸ”Ž  "},
	Internet:         {Prefix: "🌐  "},
	ISODownload:      {Prefix: "πŸ’Ώ  "},
	Kubectl:          {Prefix: "πŸ’—  "},
	Meh:              {Prefix: "πŸ™„  ", LowPrefix: LowWarning},
	Mounting:         {Prefix: "πŸ“  "},
	MountOptions:     {Prefix: "πŸ’Ύ  "},
	Permissions:      {Prefix: "πŸ”‘  "},
	Provisioner:      {Prefix: "ℹ️  "},
	Pulling:          {Prefix: "🚜  "},
	Resetting:        {Prefix: "πŸ”„  "},
	Shutdown:         {Prefix: "πŸ›‘  "},
	StartingNone:     {Prefix: "🀹  "},
	StartingSSH:      {Prefix: "πŸ”—  "},
	StartingVM:       {Prefix: "πŸ”₯  ", OmitNewline: true, Spinner: true},
	SubStep:          {Prefix: "    β–ͺ ", LowPrefix: LowIndentBullet, OmitNewline: true, Spinner: true},
	Tip:              {Prefix: "πŸ’‘  "},
	Unmount:          {Prefix: "πŸ”₯  "},
	VerifyingNoLine:  {Prefix: "πŸ€”  ", OmitNewline: true},
	Verifying:        {Prefix: "πŸ€”  "},
	CNI:              {Prefix: "πŸ”—  "},
	Toolkit:          {Prefix: "πŸ› οΈ   "},
}

Config is a map of style name to style struct For consistency, ensure that emojis added render with the same width across platforms.

Functions ΒΆ

func LowPrefix ΒΆ

func LowPrefix(s Options) string

LowPrefix returns a 7-bit compatible prefix for a style

Types ΒΆ

type Enum ΒΆ

type Enum int

Enum is an enumeration of Style

const (
	None Enum = iota
	AddonDisable
	AddonEnable
	Caching
	Celebrate
	Celebration
	Check
	Command
	Conflict
	Confused
	Connectivity
	Containerd
	ContainerRuntime
	Copying
	CRIO
	Deleted
	DeletingHost
	Docker
	Documentation
	DryRun
	Embarrassed
	Empty
	Enabling
	Failure
	Fatal
	FileDownload
	Fileserver
	Happy
	HealthCheck
	Improvement
	Indent
	Internet
	ISODownload
	Issue
	Issues
	Kubectl
	KnownIssue
	Launch
	LogEntry
	Meh
	Mounting
	MountOptions
	New
	Notice
	NotAllowed
	Option
	Pause
	Permissions
	Provisioner
	Provisioning
	Pulling
	Ready
	Resetting
	Restarting
	Running
	Sad
	SeeNoEvil
	Shrug
	Shutdown
	Sparkle
	StartingNone
	StartingSSH
	StartingVM
	Stopped
	Stopping
	SubStep
	Success
	ThumbsDown
	ThumbsUp
	Tip
	Unmount
	Unpause
	UnmetRequirement
	Unsupported
	URL
	Usage
	Verifying
	VerifyingNoLine
	Waiting
	WaitingWithSpinner
	WaitingPods
	Warning
	Workaround
	CNI
	Toolkit
)

All the Style constants available

type Options ΒΆ

type Options struct {
	// Prefix is a string to place in the beginning of a message
	Prefix string
	// LowPrefix is the 7-bit compatible prefix we fallback to for less-awesome terminals
	LowPrefix string
	// OmitNewline omits a newline at the end of a message.
	OmitNewline bool
	// Spinner is a character to place at ending of message
	Spinner bool
}

Options describes how to stylize a message.

Jump to

Keyboard shortcuts

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