disable spinner

This commit is contained in:
Daylin Morgan 2024-09-05 13:12:51 -05:00
parent cd105ae69a
commit c995d60900
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 11 additions and 3 deletions

View file

@ -53,7 +53,11 @@ proc runCmdCapt*(
# close p
close p
proc runCmdCaptWithSpinner*(cmd: string, msg: string = "", capture: set[CaptureGrp] = {CaptStdout}): tuple[output, err: string] =
proc runCmdCaptWithSpinner*(
cmd: string,
msg: string = "",
capture: set[CaptureGrp] = {CaptStdout}
): tuple[output, err: string] =
withSpinner(msg):
let (output, err, code) = runCmdCapt(cmd, capture)
if code != 0:

View file

@ -179,8 +179,12 @@ proc error*(spinny: Spinny, msg: string) =
template withSpinner*(msg: string = "", body: untyped): untyped =
var spinner {.inject.} = newSpinny(msg, Dots)
spinner.setSymbolColor(fgBlue)
if isatty(stdout): # don't spin if it's not a tty
start spinner
body
if isatty(stdout):
stop spinner
template withSpinner*(body: untyped): untyped =