Documentation
¶
Overview ¶
Package spinner implements a colorful console spinner
Index ¶
- Constants
- Variables
- type Option
- func CharSet(c []string) Option
- func ColorLevel(cl color.Level) Option
- func FinalMessage(m string) Option
- func Format(f string) Option
- func HideCursor(h bool) Option
- func Interval(d time.Duration) Option
- func MaxMessageLength(l int) Option
- func MessageEllipsis(l string) Option
- func MessageFormat(f string) Option
- func Order(o ...int) Option
- func Prefix(p string) Option
- func ProgressFormat(f string) Option
- func ProgressIndicatorFormat(f string) Option
- func Reverse() Option
- func Variant(v int) Option
- type Spinner
Constants ¶
View Source
const ( BlockVertical int = iota // Arrows BouncingBlock Blink FlyingLine RotatingCircle Clock HalfClock HalfClock2 Snake Snake2 FlyingDots Dots10 Dots13 Dots14 BlockHorizontal Toggle ToggleSmall Arrows01 Arrows02 Arrows03 Arrows04 Dots21 Dots22 Dots23 Dots24 Dots25 Dots26 Dev Dev2 // Weather Simple )
Declared spinner variants
View Source
const ( // Char represents char element Char = 1 + iota // Message represents message element Message // Progress represents progress element Progress )
View Source
const Line = Simple
Line is alias for Simple
Variables ¶
View Source
var CharSets = map[int]settings{ Arrows01: { 120 * time.Millisecond, []string{"←", "↑", "→", "↓"}, &defaultPalette, }, Arrows02: { 120 * time.Millisecond, []string{"↖", "↗", "↘", "↙"}, &defaultPalette, }, Arrows03: { 120 * time.Millisecond, []string{"⇐", "⇖", "⇑", "⇗", "⇒", "⇘", "⇓", "⇙"}, &defaultPalette, }, Arrows04: { 120 * time.Millisecond, []string{"▹▹▹▹▹", "▸▹▹▹▹", "▹▸▹▹▹", "▹▹▸▹▹", "▹▹▹▸▹", "▹▹▹▹▸"}, &defaultPalette, }, Simple: { 120 * time.Millisecond, []string{"|", "\\", "─", "/"}, &defaultPalette, }, Dev: { 400 * time.Millisecond, []string{"+"}, &defaultPalette, }, Dev2: { 250 * time.Millisecond, []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}, &defaultPalette, }, BlockVertical: { 120 * time.Millisecond, []string{"▁", "▃", "▄", "▅", "▆", "▇", "█", "▇", "▆", "▅", "▄", "▃", "▁"}, &defaultPalette, }, BlockHorizontal: { 120 * time.Millisecond, []string{"▉", "▊", "▋", "▌", "▍", "▎", "▏", "▎", "▍", "▌", "▋", "▊", "▉"}, &defaultPalette, }, BouncingBlock: { 120 * time.Millisecond, []string{"▖", "▘", "▝", "▗"}, &defaultPalette, }, RotatingCircle: { 120 * time.Millisecond, []string{"◐", "◓", "◑", "◒"}, &defaultPalette, }, Snake: { 150 * time.Millisecond, []string{"⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"}, &defaultPalette, }, Snake2: { 120 * time.Millisecond, []string{"⠏", "⠛", "⠹", "⢸", "⣰", "⣤", "⣆", "⡇"}, &defaultPalette, }, FlyingDots: { 120 * time.Millisecond, []string{ "⢀⠀", "⡀⠀", "⠄⠀", "⢂⠀", "⡂⠀", "⠅⠀", "⢃⠀", "⡃⠀", "⠍⠀", "⢋⠀", "⡋⠀", "⠍⠁", "⢋⠁", "⡋⠁", "⠍⠉", "⠋⠉", "⠋⠉", "⠉⠙", "⠉⠙", "⠉⠩", "⠈⢙", "⠈⡙", "⢈⠩", "⡀⢙", "⠄⡙", "⢂⠩", "⡂⢘", "⠅⡘", "⢃⠨", "⡃⢐", "⠍⡐", "⢋⠠", "⡋⢀", "⠍⡁", "⢋⠁", "⡋⠁", "⠍⠉", "⠋⠉", "⠋⠉", "⠉⠙", "⠉⠙", "⠉⠩", "⠈⢙", "⠈⡙", "⠈⠩", "⠀⢙", "⠀⡙", "⠀⠩", "⠀⢘", "⠀⡘", "⠀⠨", "⠀⢐", "⠀⡐", "⠀⠠", "⠀⢀", "⠀⡀", }, &defaultPalette, }, FlyingLine: { 120 * time.Millisecond, []string{"| ", " | ", " | ", " |", " |", " | ", " | ", "| "}, &defaultPalette, }, Dots10: { 120 * time.Millisecond, []string{"⢄", "⢂", "⢁", "⡁", "⡈", "⡐", "⡠"}, &defaultPalette, }, Dots13: { 120 * time.Millisecond, []string{"⠁", "⠂", "⠄", "⡀", "⢀", "⠠", "⠐", "⠈"}, &defaultPalette, }, Dots14: { 120 * time.Millisecond, []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}, &defaultPalette, }, Dots21: { 120 * time.Millisecond, []string{ "⠁", "⠁", "⠉", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠤", "⠄", "⠄", "⠤", "⠠", "⠠", "⠤", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋", "⠉", "⠈", "⠈", }, &defaultPalette, }, Dots22: { 120 * time.Millisecond, []string{ "⠈", "⠉", "⠋", "⠓", "⠒", "⠐", "⠐", "⠒", "⠖", "⠦", "⠤", "⠠", "⠠", "⠤", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋", "⠉", "⠈", }, &defaultPalette, }, Dots26: { 120 * time.Millisecond, []string{"⢹", "⢺", "⢼", "⣸", "⣇", "⡧", "⡗", "⡏"}, &defaultPalette, }, Blink: { 200 * time.Millisecond, []string{"▓", "▒", "░"}, &defaultPalette, }, Toggle: { 250 * time.Millisecond, []string{"■", "□"}, &defaultPalette, }, Dots23: { 120 * time.Millisecond, []string{ "⠁", "⠉", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠤", "⠄", "⠄", "⠤", "⠴", "⠲", "⠒", "⠂", "⠂", "⠒", "⠚", "⠙", "⠉", "⠁", }, &defaultPalette, }, Dots24: { 120 * time.Millisecond, []string{". ", ".. ", "...", " ..", " .", " "}, &defaultPalette, }, Dots25: { 120 * time.Millisecond, []string{"⠋", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋"}, &defaultPalette, }, }
CharSets contains the available character sets
Functions ¶
This section is empty.
Types ¶
type Option ¶
Option type for functional options
func ColorLevel ¶
ColorLevel sets color level support for spinner - TNoColor, TColor16, TColor256, TTrueColor
func MaxMessageLength ¶
MaxMessageLength sets spinner's max message length
func MessageEllipsis ¶
MessageEllipsis sets spinner's messageEllipsis
func ProgressFormat ¶
ProgressFormat sets spinner progress indicator format
func ProgressIndicatorFormat ¶
ProgressIndicatorFormat sets spinner progress indicator format
type Spinner ¶
Spinner struct representing spinner instance
func (*Spinner) Current ¶
func (s *Spinner) Current()
Current writes spinner current frame to output represented by spinner writer
Click to show internal directories.
Click to hide internal directories.