mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-05 06:03:15 -06:00
disable spinner
This commit is contained in:
parent
cd105ae69a
commit
c995d60900
2 changed files with 11 additions and 3 deletions
|
@ -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:
|
||||
|
|
|
@ -179,9 +179,13 @@ proc error*(spinny: Spinny, msg: string) =
|
|||
template withSpinner*(msg: string = "", body: untyped): untyped =
|
||||
var spinner {.inject.} = newSpinny(msg, Dots)
|
||||
spinner.setSymbolColor(fgBlue)
|
||||
start spinner
|
||||
if isatty(stdout): # don't spin if it's not a tty
|
||||
start spinner
|
||||
|
||||
body
|
||||
stop spinner
|
||||
|
||||
if isatty(stdout):
|
||||
stop spinner
|
||||
|
||||
template withSpinner*(body: untyped): untyped =
|
||||
withSpinner("", body)
|
||||
|
|
Loading…
Reference in a new issue