diff options
-rwxr-xr-x | lib/intentions-queue | 19 |
1 files changed, 19 insertions, 0 deletions
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]\+' +} |