new script: pue (compact pueue status)

This commit is contained in:
Alexander Gehrke 2020-08-06 21:39:05 +02:00
parent dfb4394dbf
commit f8d866b623

40
misc/pue Executable file
View file

@ -0,0 +1,40 @@
#!/bin/zsh
JQ_PREDEF='
def colors:
{
"black": "\u001b[30m",
"red": "\u001b[31m",
"green": "\u001b[32m",
"yellow": "\u001b[33m",
"blue": "\u001b[34m",
"magenta": "\u001b[35m",
"cyan": "\u001b[36m",
"lightgray": "\u001b[37m",
"reset": "\u001b[0m",
"gray": "\u001b[90m",
"lightred": "\u001b[91m",
"lightgreen": "\u001b[92m",
"lightyellow": "\u001b[93m",
"lightblue": "\u001b[94m",
"lightmagenta": "\u001b[95m",
"lightcyan": "\u001b[96m",
"white": "\u001b[97m",
};
def gettime: if . == null then "?" else [scan("\\d\\d:\\d\\d")][0] end;
'
#pueue compact output
JQ_STATUS=$JQ_PREDEF'
def prefix:
if .status == "Done" then colors.lightgreen + "✔ "
elif .status == "Running" then colors.lightyellow + "… "
else colors.gray + "⌛"
end;
.tasks[]| "\(prefix)\t\(.id)\t\(.command)\t\(.start|gettime) - \(.end|gettime)" + colors.reset
'
pueue status -j | jq -r $JQ_STATUS | column -t -s $'\t'