From df209b9b8bbb579d58872bf9353e0bb0d01a1b10 Mon Sep 17 00:00:00 2001 From: Wilhelm Schuermann Date: Tue, 31 Mar 2015 07:08:53 +0200 Subject: [PATCH] TW-1587: Further improve example on-exit hook - Initial patch was not quite right. on-exit _does_ receive added and modified tasks on STDIN, but is not allowed to return JSON. --- ChangeLog | 2 ++ scripts/hooks/on-exit | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce5e3c402..5d3920c0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ to Ulf Eliasson). - TW-1583 Invalid ID displayed for first report after done/delete (thanks to Ulf Eliasson). +- TW-1587 Fix and improve example on-exit hook, adjust to new hooks API + (thanks to Jochen Sprickerhof). - Setting 'bulk' to zero is interpreted as infinity, which means there is no amount of changes that is considered dangerous (thanks to Tomas Babej). diff --git a/scripts/hooks/on-exit b/scripts/hooks/on-exit index 572b534c9..ea830d9e6 100755 --- a/scripts/hooks/on-exit +++ b/scripts/hooks/on-exit @@ -5,9 +5,16 @@ # Output: # - Optional feedback/error. -echo 'on-exit' + +n=0 +while read modified_task +do + n=$(($n + 1)) +done + +echo "on-exit: Counted $n added/modified tasks." # Status: -# - 0: JSON ignored, non-JSON is feedback. -# - non-0: JSON ignored, non-JSON is error. +# - 0: Non-JSON is feedback. +# - non-0: Non-JSON is error. exit 0