Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 2.32 KB

README.md

File metadata and controls

57 lines (43 loc) · 2.32 KB

Go GitHub go.mod Go version Go Report Card Coverage Status Release License: MIT Go report card Release Drafter

TERMite

Termite is my playground for terminal app utilities and visual elements such as progress bars and indicators, cursor control and screen updates.

Install

go get github.com/sha1n/termite

Examples

Spinner

refreshInterval := time.Millisecond * 100
spinner := termite.NewSpinner(termite.StdoutWriter, "Processing...", refreshInterval, termite.DefaultSpinnerFormatter())

if _, e := spinner.Start(); e == nil {
  doWork()
  
  _ = spinner.Stop("Done!")
}

Progress Bar

termWidth, _, _ := termite.GetTerminalDimensions()
progressBar := termite.NewProgressBar(termite.StdoutWriter, tickCount, width, termWidth, termite.DefaultProgressBarFormatter())

if tick, cancel, err := progressBar.Start(); err == nil {
  defer cancel()
  
  doWork(tick)
}

Showcase

The code for this demo can be found in internal/main.go (go run internal/main.go).