spinner

package
v12.58.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package spinner provides methods for creating spinner animation for long-running tasks

Index

Examples

Constants

This section is empty.

Variables

View Source
var DisableAnimation = false

DisableAnimation is global animation off switch flag

View Source
var ErrColorTag = "{r}"

ErrColorTag is cross color tag (see fmtc package)

View Source
var OkColorTag = "{g}"

OkColorTag is check color tag (see fmtc package)

View Source
var SkipColorTag = "{s}"

SkipColorTag is skipped action color tag (see fmtc package)

View Source
var SpinnerColorTag = "{y}"

SpinnerColorTag is spinner animation color tag (see fmtc package)

View Source
var TimeColorTag = "{s-}"

TimeColorTag is time color tag (see fmtc package)

Functions

func Done

func Done(ok bool)

Done finishes spinner animation and shows task status

Example
Show("My long running task with good result")
time.Sleep(time.Second)
Done(true)

Show("My long running task with bad result")
time.Sleep(time.Second)
Done(false)
Output:

func Show

func Show(message string, args ...interface{})

Show shows spinner with given task description

Example
file := "file.txt"
Show("Removing file %s", file)
time.Sleep(time.Second)
Done(true)
Output:

func Skip added in v12.46.0

func Skip()

Skip finishes spinner animation and mark it as skipped

func Update

func Update(message string, args ...interface{})

Update updates task description

Example
Show("My long running task")
time.Sleep(time.Second)
Show("My long running task still working")
time.Sleep(time.Second)
Done(true)
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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