Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 2.21 KB

README.md

File metadata and controls

67 lines (51 loc) · 2.21 KB

🏵️ Go Console Spinner

UPD. development frozen

*** COMING SOON ***

Build Status Go Report Card Coverage Status GitHub

API may be a subject to change

Features

  • highly configurable (options)

  • progress indication during spin spinner.Progress(0.5)50%

  • messages during spin spinner.Message("message")

  • configurable elements order - chars, messages and progress

  • separated format settings for chars, messages and progress

  • hides cursor on spinner.Start(), shows on spinner.Stop()

  • cursor hide can be disabled spinner.HideCursor(false)

  • has Erase() method

  • has Current() method to write current frame again for smooth animation

  • final message

  • supports pipe | and redirect > output

  • separated color settings for chars, messages and progress

  • has Disable() and Enable() methods (questionable)

It's a proof of concept and kinda port of alecrabbit/php-console-spinner

For now you can try it as is and shape it's development if you wish

Xterm terminal(package uses ANSI codes)

Works on Windows too! Thanks to mattn/go-colorable

Quickstart

package main

import (
    "time"

    "github.com/alecrabbit/go-cli-spinner"
)

func main() {
    s, _ := spinner.New()
    // Start spinner
    s.Start()
    // Doing some work
    time.Sleep(3 * time.Second)
    // Set current message
    s.Message("Current message")
    // Set current progress
    s.Progress(0.511)
    // Doing some work
    time.Sleep(3 * time.Second)
    // Stop spinner
    s.Stop()
}