wow

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: MIT Imports: 9 Imported by: 66

README

wow

GoDoc

Beautiful spinners for Go commandline apps

wow

Install

go get -u github.com/gernest/wow

Usage

package main

import (
	"os"
	"time"

	"github.com/gernest/wow"
	"github.com/gernest/wow/spin"
)

func main() {
	w := wow.New(os.Stdout, spin.Get(spin.Dots), "Such Spins")
	w.Start()
	time.Sleep(2 * time.Second)
	w.Text("Very emojis").Spinner(spin.Get(spin.Hearts))
	time.Sleep(2 * time.Second)
	w.PersistWith(spin.Spinner{Frames: []string{"👍"}}, " Wow!")
}

Available spinners

Name What it looks like
Star2 star2
GrowHorizontal growHorizontal
Squish squish
Toggle12 toggle12
Smiley smiley
Hearts hearts
Dots3 dots3
Dots11 dots11
Balloon balloon
Clock clock
Dots4 dots4
SquareCorners squareCorners
CircleHalves circleHalves
Star star
Arc arc
Toggle13 toggle13
BoxBounce boxBounce
Line2 line2
Pipe pipe
Triangle triangle
Shark shark
Line line
Arrow arrow
Earth earth
Dots5 dots5
Toggle11 toggle11
CircleQuarters circleQuarters
Toggle9 toggle9
Dots9 dots9
Bounce bounce
Toggle2 toggle2
Toggle7 toggle7
Arrow3 arrow3
Moon moon
Dots6 dots6
Christmas christmas
Dots10 dots10
Hamburger hamburger
BoxBounce2 boxBounce2
BouncingBar bouncingBar
Flip flip
Dots8 dots8
Dots12 dots12
Noise noise
Toggle3 toggle3
Toggle6 toggle6
Runner runner
Dqpb dqpb
Dots dots
Toggle4 toggle4
Monkey monkey
Dots7 dots7
SimpleDots simpleDots
GrowVertical growVertical
Circle circle
Toggle toggle
Toggle5 toggle5
Arrow2 arrow2
Dots2 dots2
Toggle8 toggle8
Toggle10 toggle10
BouncingBall bouncingBall
SimpleDotsScrolling simpleDotsScrolling
Pong pong
Weather weather
Balloon2 balloon2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForceOutput

func ForceOutput(w *Wow)

ForceOutput forces all output even if not not outputting directly to a terminal

Types

type LogSymbol

type LogSymbol uint

LogSymbol is a log severity level

const (
	INFO LogSymbol = iota
	SUCCESS
	WARNING
	ERROR
)

common log symbos

func (LogSymbol) String

func (s LogSymbol) String() string

type Wow

type Wow struct {
	IsTerminal bool
	// contains filtered or unexported fields
}

Wow writes beautiful spinners on the terminal.

func New

func New(o io.Writer, s spin.Spinner, text string, options ...func(*Wow)) *Wow

New creates a new wow instance ready to start spinning.

func (*Wow) Persist

func (w *Wow) Persist()

Persist writes the last character of the currect spinner frames together with the text on stdout.

A new line is added at the end to ensure the text stay that way.

func (*Wow) PersistWith

func (w *Wow) PersistWith(s spin.Spinner, text string)

PersistWith writes the last frame of s together with text with a new line added to make it stick.

func (*Wow) Spinner

func (w *Wow) Spinner(s spin.Spinner) *Wow

Spinner sets s to the current spinner

func (*Wow) Start

func (w *Wow) Start()

Start starts the spinner. The frames are written based on the spinner interval.

func (*Wow) Stop

func (w *Wow) Stop()

Stop stops the spinner

func (*Wow) Text

func (w *Wow) Text(txt string) *Wow

Text adds text to the current spinner

Directories

Path Synopsis
example
all
DO NOT EDIT : this file was automatically generated.
DO NOT EDIT : this file was automatically generated.
DO NOT EDIT : this file was automatically generated.
DO NOT EDIT : this file was automatically generated.

Jump to

Keyboard shortcuts

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