Skip to content

Simple activity indicator for your command line tools.

License

Notifications You must be signed in to change notification settings

lucasepe/spinner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal CLI Spinner

Example

package main

import (
    "fmt"
    "time"

    "github.com/lucasepe/spinner"
)

func main() {
    fmt.Println("This may take some time:")

    s := spinner.StartNew("Task 1: Processing...")
    time.Sleep(3 * time.Second)
    s.Stop()
    fmt.Println("✓  Task 1: Completed")

    s = spinner.NewSpinner("Task 2: Processing...")
    s.Start()
    s.SetSpeed(100 * time.Millisecond)
    time.Sleep(3 * time.Second)
    s.SetText("About to change spinner shape...")
    time.Sleep(1 * time.Second)

    s.SetCharset([]string{"☱", "☲", "☴"})
    s.SetText(" Shape changed")
    time.Sleep(1 * time.Second)
    s.SetText(" Task 2: Processing...")
    time.Sleep(3 * time.Second)
    s.Stop()

    fmt.Println("✓  Task 2: Completed")
}

Credits

This is a modified version of https://github.com/janeczku/go-spinner.

About

Simple activity indicator for your command line tools.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages