2020-08-06 19:39:05 +00:00
|
|
|
#!/bin/zsh
|
2020-08-11 10:09:05 +00:00
|
|
|
#dep:pueue jq column
|
2020-08-06 19:39:05 +00:00
|
|
|
|
|
|
|
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'
|