summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/intentions-queue11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/intentions-queue b/lib/intentions-queue
index e9b79de..c92a4d1 100755
--- a/lib/intentions-queue
+++ b/lib/intentions-queue
@@ -68,11 +68,18 @@ execute_intention() {
"${intentions_directory}/intention.${next_number}"
}
-# intentions_left
+# intentions_left [-n]
# check if there are undone intentions left
# return 0 if there is something left to do
# return 1 if nothing is queued
+# with -n: return immediately
+# without -n: wait until nothing more to do
intentions_left() {
+ if [ ! "x$1" = 'x-n' ]; then
+ while intentions_left -n; do
+ sleep 1
+ done
+ fi
find "${intentions_directory}" \
-maxdepth 1 \
-type f \
@@ -90,7 +97,7 @@ intentions_left() {
# execute_all_intentions
# executes all intentions
execute_all_intentions() {
- while intentions_left; do
+ while intentions_left -n; do
execute_intention
done
}