Skip to content
/ termite Public

A library of rich terminal app utilities and visual elements such as progress indicators, cursor control and APIs for rendering and updating content in-place.

License

Notifications You must be signed in to change notification settings

sha1n/termite

Repository files navigation

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).

About

A library of rich terminal app utilities and visual elements such as progress indicators, cursor control and APIs for rendering and updating content in-place.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •