Documentation ΒΆ
Overview ΒΆ
Package round is a command line spinner. Start one with Go.
The package will intelligently decide whether to write spinners on stdout, stderr or neither, depending if a terminal is present.
Wrappers for Stdout and Stderr are provided so as not to interfere with the spinner while running.
Index ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
var ( // Stdout is a spin-safe version of os.Stdout. Stdout io.Writer // Stderr is a spin-safe version of os.Stderr. Stderr io.Writer )
var Block = Style{ []string{"β", "β", "β", "β", "β", "β", "β", "β", "β", "β", "β ", "β", "β", "β", "β", ""}, 60 * time.Millisecond, }
Block is a good old trusty block thing. It uses "β" from 2580β259F Block Elements.
var Cylon = NewBouncer(7, "\x1b[1m(\x1b[31m%v\x1b[0;1m)\x1b[0m", "@")
Cylon is ominous. It uses "@" from 0020β007F Basic Latin.
var Hearts = Style{ []string{"πππππ", "πππππ", "πππππ", "πππππ", "πππππ"}, 90 * time.Millisecond, }
Hearts is clearly the best style! It uses "π" from 1F300β1F5FF Misc Symbols and Pictographs.
var Moon = Style{[]string{"π", "π", "π", "π", "π", "π", "π", "π"}, 90 * time.Millisecond}
Moon is a series of moon phases. It uses "π" from 1F300β1F5FF Misc Symbols and Pictographs.
var Pipe = Style{[]string{"|", "/", "-", "\\"}, 60 * time.Millisecond}
Pipe is guaranteed to work. It uses "|" from 0020β007F Basic Latin.
Functions ΒΆ
Types ΒΆ
type Style ΒΆ
Style is a spinner style. Any number of frames is allowed, each frame can be any length. The following Styles are supplied: Block, Cylon, Hearts, Moon, Pipe.
func NewBouncer ΒΆ
NewBouncer creates a Style with some text that bounces back and forth.
func NewInvertedBouncer ΒΆ
NewInvertedBouncer creates a Style just like NewBouncer except it goes in the opposite direction at the start. For the true pedant.
func NewInvertedScroller ΒΆ
NewInvertedScroller creates a Style for a text scroller with the specified width and format. It scrolls from left to right.
func NewScroller ΒΆ
NewScroller creates a Style for a text scroller with the specified width and format. It scrolls from right to left.