From 90750bad1b9337731f7ba45b7d4a15544b0e51f6 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 30 Jan 2020 11:04:19 +0100 Subject: lib/intentions-queue: intentions_left() new --- lib/intentions-queue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/intentions-queue b/lib/intentions-queue index e6c2e25..789d2d5 100755 --- a/lib/intentions-queue +++ b/lib/intentions-queue @@ -81,3 +81,22 @@ execute_intention() { ) || return 0 "${intentions_directory}/intention.${next_number}" } + +# intentions_left +# check if there are undone intentions left +# return 0 if there is something left to do +# return 1 if nothing is queued +intentions_left() { + find "${intentions_directory}" \ + -maxdepth 1 \ + -type f \ + -name 'intention.*' \ + -printf '%f\n' \ + | sed ' + s/^intention\.// + t + d + ' \ + | sort -n \ + | grep -qxm1 '[0-9]\+' +} -- cgit v1.2.3-70-g09d2