From 3f2df5a3b6b817c1acbd1066455fb4b1fe85bf3e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 14 May 2014 20:10:37 -0400 Subject: [PATCH] Hooks - Added example hook scripts. --- scripts/CMakeLists.txt | 2 +- scripts/hooks/on-add | 23 +++++++++++++++++++++++ scripts/hooks/on-exit | 22 ++++++++++++++++++++++ scripts/hooks/on-launch | 22 ++++++++++++++++++++++ scripts/hooks/on-modify | 25 +++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100755 scripts/hooks/on-add create mode 100755 scripts/hooks/on-exit create mode 100755 scripts/hooks/on-launch create mode 100755 scripts/hooks/on-modify diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 9de02dc8c..edc8e2eb5 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 2.8) -install (DIRECTORY bash fish vim zsh +install (DIRECTORY bash fish vim zsh hooks DESTINATION ${TASK_DOCDIR}/scripts) install (DIRECTORY add-ons DESTINATION ${TASK_DOCDIR}/scripts diff --git a/scripts/hooks/on-add b/scripts/hooks/on-add new file mode 100755 index 000000000..3c0ce92e1 --- /dev/null +++ b/scripts/hooks/on-add @@ -0,0 +1,23 @@ +#!/bin/bash + +# Input: +# - New task JSON. +read new_task + +# Processing goes here. + +# Output: +# - Any line of JSON emitted is added as a new task. +# - Any non-JSON emitted is displayed as a message. +echo on-add + +# Exit: +# - 0 Means accept $new_task if JSON is not emitted. +# - 0 Means accept all JSON as new tasks. If UUID matches $new_task, use this +# JSON instead of $new_task. If UUID does not match $new_task, then these +# are additional tasks. +# - 0 Means all non-JSON becomes footnote entries. +# - 1 Means all non-JSON becomes error entries. +# - 1 Means reject $new_task. +exit 0 + diff --git a/scripts/hooks/on-exit b/scripts/hooks/on-exit new file mode 100755 index 000000000..7a7db78d5 --- /dev/null +++ b/scripts/hooks/on-exit @@ -0,0 +1,22 @@ +#!/bin/bash + +# Input: +# - None + +# Processing goes here. + +# Output: +# - Any line of JSON emitted is added as a new task. +# - Any non-JSON emitted is displayed as a message. +echo on-exit + +# Exit: +# - 0 Means accept $new_task if JSON is not emitted. +# - 0 Means accept all JSON as new tasks. If UUID matches $new_task, use this +# JSON instead of $new_task. If UUID does not match $new_task, then these +# are additional tasks. +# - 0 Means all non-JSON becomes footnote entries. +# - 1 Means all non-JSON becomes error entries. +# - 1 Means reject $new_task. +exit 0 + diff --git a/scripts/hooks/on-launch b/scripts/hooks/on-launch new file mode 100755 index 000000000..ed5ccf94a --- /dev/null +++ b/scripts/hooks/on-launch @@ -0,0 +1,22 @@ +#!/bin/bash + +# Input: +# - None + +# Processing goes here. + +# Output: +# - Any line of JSON emitted is added as a new task. +# - Any non-JSON emitted is displayed as a message. +echo on-launch + +# Exit: +# - 0 Means accept $new_task if JSON is not emitted. +# - 0 Means accept all JSON as new tasks. If UUID matches $new_task, use this +# JSON instead of $new_task. If UUID does not match $new_task, then these +# are additional tasks. +# - 0 Means all non-JSON becomes footnote entries. +# - 1 Means all non-JSON becomes error entries. +# - 1 Means reject $new_task. +exit 0 + diff --git a/scripts/hooks/on-modify b/scripts/hooks/on-modify new file mode 100755 index 000000000..8107f93ab --- /dev/null +++ b/scripts/hooks/on-modify @@ -0,0 +1,25 @@ +#!/bin/bash + +# Input: +# - Original task JSON +# - Modified task JSON +read original_task +read modified_task + +# Processing goes here. + +# Output: +# - Any line of JSON emitted is added as a new task. +# - Any non-JSON emitted is displayed as a message. +echo on-modify + +# Exit: +# - 0 Means accept $new_task if JSON is not emitted. +# - 0 Means accept all JSON as new tasks. If UUID matches $new_task, use this +# JSON instead of $new_task. If UUID does not match $new_task, then these +# are additional tasks. +# - 0 Means all non-JSON becomes footnote entries. +# - 1 Means all non-JSON becomes error entries. +# - 1 Means reject $new_task. +exit 0 +