From f8d866b623b06e9b494283e2c68d90f79a1e307a Mon Sep 17 00:00:00 2001 From: Alexander Gehrke Date: Thu, 6 Aug 2020 21:39:05 +0200 Subject: [PATCH] new script: pue (compact pueue status) --- misc/pue | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 misc/pue diff --git a/misc/pue b/misc/pue new file mode 100755 index 0000000..20bc3e9 --- /dev/null +++ b/misc/pue @@ -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'