spin
Animated terminal spinner backed by a background thread. The simplest usage is the withSpinner template, which starts the spinner, runs a block, then stops it automatically.
import std/os import hwylterm/spin withSpinner("loading..."): sleep 2000
Use spinner.setText inside the block to update the message while running:
import std/os import hwylterm/spin withSpinner("step 1"): sleep 500 spinner.setText("step 2") sleep 500 spinner.setText("done") sleep 500
To pick a specific spinner style, use the with template:
import std/os import hwylterm/spin Moon.with("loading..."): sleep 2000
See spinners: SpinnerKind for all available styles.
Consts
defaultSpinnerKind = Dots2
- Source Edit
Procs
Templates
template useSpinner(spinner: Spinny; body: untyped)
- Source Edit
template with(kind: SpinnerKind; msg: BbString; body: untyped): untyped
- Source Edit
template with(kind: SpinnerKind; msg: string; body: untyped): untyped
- Source Edit
template withSpinner(body: untyped): untyped
- Source Edit
template withSpinner(msg: BbString = bb""; body: untyped): untyped
- Source Edit
template withSpinner(msg: string = ""; body: untyped): untyped
- Source Edit