mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 18:30:43 -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
|
||||||
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):
|
withSpinner(msg):
|
||||||
let (output, err, code) = runCmdCapt(cmd, capture)
|
let (output, err, code) = runCmdCapt(cmd, capture)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
|
|
|
@ -179,8 +179,12 @@ proc error*(spinny: Spinny, msg: string) =
|
||||||
template withSpinner*(msg: string = "", body: untyped): untyped =
|
template withSpinner*(msg: string = "", body: untyped): untyped =
|
||||||
var spinner {.inject.} = newSpinny(msg, Dots)
|
var spinner {.inject.} = newSpinny(msg, Dots)
|
||||||
spinner.setSymbolColor(fgBlue)
|
spinner.setSymbolColor(fgBlue)
|
||||||
|
if isatty(stdout): # don't spin if it's not a tty
|
||||||
start spinner
|
start spinner
|
||||||
|
|
||||||
body
|
body
|
||||||
|
|
||||||
|
if isatty(stdout):
|
||||||
stop spinner
|
stop spinner
|
||||||
|
|
||||||
template withSpinner*(body: untyped): untyped =
|
template withSpinner*(body: untyped): untyped =
|
||||||
|
|
Loading…
Reference in a new issue