mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-01-22 03:07:31 -06:00
delineate output better
This commit is contained in:
parent
b9922f793d
commit
fcc048aa55
2 changed files with 24 additions and 3 deletions
|
@ -5,7 +5,7 @@
|
||||||
}:
|
}:
|
||||||
buildNimblePackage {
|
buildNimblePackage {
|
||||||
name = "oizys";
|
name = "oizys";
|
||||||
verions = "unstable";
|
version = "unstable";
|
||||||
src = lib.cleanSource ./.;
|
src = lib.cleanSource ./.;
|
||||||
nativeBuildInputs = [ openssl ];
|
nativeBuildInputs = [ openssl ];
|
||||||
nimbleDepsHash = "sha256-dFJw/m7D5UFUrHH7exsyHknt8WHIK1QIQATNd5l7FZA=";
|
nimbleDepsHash = "sha256-dFJw/m7D5UFUrHH7exsyHknt8WHIK1QIQATNd5l7FZA=";
|
||||||
|
|
|
@ -56,6 +56,28 @@ proc runCmdCapt*(
|
||||||
|
|
||||||
close p
|
close p
|
||||||
|
|
||||||
|
proc formatStdoutStderr(stdout: string, stderr: string): string =
|
||||||
|
template addLine =
|
||||||
|
# TODO: make -> red after hwylterm update
|
||||||
|
result.add "-> "
|
||||||
|
result.add line
|
||||||
|
result.add "\n"
|
||||||
|
result.add "stdout:\n"
|
||||||
|
for line in stdout.splitLines():
|
||||||
|
addLine
|
||||||
|
# result.add bb"[red]->[/]"
|
||||||
|
# result.add "-> "
|
||||||
|
# result.add line
|
||||||
|
# result.add "\n"
|
||||||
|
result.add "stdout:\n"
|
||||||
|
for line in stderr.splitLines():
|
||||||
|
addLine
|
||||||
|
result.add "-> "
|
||||||
|
result.add line
|
||||||
|
result.add "\n"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
proc runCmdCaptWithSpinner*(
|
proc runCmdCaptWithSpinner*(
|
||||||
cmd: string,
|
cmd: string,
|
||||||
msg: string = "",
|
msg: string = "",
|
||||||
|
@ -67,8 +89,7 @@ proc runCmdCaptWithSpinner*(
|
||||||
with(Dots2, msg):
|
with(Dots2, msg):
|
||||||
(output, err, code) = runCmdCapt(cmd, capture)
|
(output, err, code) = runCmdCapt(cmd, capture)
|
||||||
if code != 0:
|
if code != 0:
|
||||||
stderr.writeLine("stdout\n" & output)
|
stderr.write(formatStdoutStderr(output,err))
|
||||||
stderr.writeLine("stderr\n" & err)
|
|
||||||
error fmt"{cmd} had non zero exit"
|
error fmt"{cmd} had non zero exit"
|
||||||
quit code
|
quit code
|
||||||
return (output, err)
|
return (output, err)
|
||||||
|
|
Loading…
Reference in a new issue