aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillermo Ramos2021-09-13 17:15:42 +0200
committerGuillermo Ramos2021-09-13 17:15:42 +0200
commitbbc4a8a104ad939cc47f00d533e73eccf61213cc (patch)
tree2b588f901421e424f9a8376ba85d970cd6f73765
parent413d00a40c43e6f7c6c92f363f71400e04b3d0f5 (diff)
downloadcli-bbc4a8a104ad939cc47f00d533e73eccf61213cc.tar.gz
gromo: sort status by total time
-rwxr-xr-xgromo11
1 files changed, 6 insertions, 5 deletions
diff --git a/gromo b/gromo
index 9cf9b62..39654cc 100755
--- a/gromo
+++ b/gromo
@@ -88,7 +88,7 @@ cmd_status() {
if [ -d "$TODAY_DIR" ]; then
# needs nullglob
for task_file in "$TODAY_DIR"/*; do
- out=$(
+ out+=$(
awk -F $FS -f - "$task_file" <<EOF
{ tasks[\$1][\$2] = \$3 }
END {
@@ -103,11 +103,12 @@ END {
}
EOF
)
-
- while IFS=$FS read -r task dur gromos; do
- echo -e "$task\n\t$gromos gromos, $(pp_seconds $dur)"
- done <<<"$out"
+ out+="\n"
done
+
+ while IFS=$FS read -r task dur gromos; do
+ echo -e "$task\n\t$gromos gromos, $(pp_seconds $dur)"
+ done <<<$(echo -e "$out" | sort -t $FS -k 2 -rn)
fi
fi
}