mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 10:10:45 -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,9 +179,13 @@ 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)
|
||||||
start spinner
|
if isatty(stdout): # don't spin if it's not a tty
|
||||||
|
start spinner
|
||||||
|
|
||||||
body
|
body
|
||||||
stop spinner
|
|
||||||
|
if isatty(stdout):
|
||||||
|
stop spinner
|
||||||
|
|
||||||
template withSpinner*(body: untyped): untyped =
|
template withSpinner*(body: untyped): untyped =
|
||||||
withSpinner("", body)
|
withSpinner("", body)
|
||||||
|
|
Loading…
Reference in a new issue