uilive

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 1 Imported by: 0

README

UILive

GoDoc Go Version

This project is a fork of gosuri/uilive which hasn't been updated for years.

UILive is a go library for updating terminal output in realtime. It provides a buffered io.Writer that is flushed at a timed interval.

Installation

$ go get -v github.com/Adaendra/uilive

How to use it ?

Calling uilive.New() will create a new writer. To start rendering, simply call writer.Start() and update the ui by writing to the writer. Full source for the below example is in example/single_line/single_line.go.

writer := uilive.New()
// start listening for updates and render
writer.Start()

for i := 0; i <= 100; i++ {
  fmt.Fprintf(writer, "Downloading.. (%d/%d) GB\n", i, 100)
  time.Sleep(time.Millisecond * 5)
}

fmt.Fprintln(writer, "Finished: Downloaded 100GB")
writer.Stop() // flush and stop rendering

The above will render

example

All examples

Documentation

Overview

Package uilive provides a writer that live updates the terminal. It provides a buffered io.Writer that is flushed at a timed interval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *writer.Writer

New returns a new Writer with defaults

Types

This section is empty.

Directories

Path Synopsis
example
pkg

Jump to

Keyboard shortcuts

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