mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Hooks
- Updated documentation and style of example hook scripts.
This commit is contained in:
parent
ec0757b2c9
commit
51291f76fe
4 changed files with 47 additions and 54 deletions
|
@ -3,20 +3,18 @@
|
||||||
# The on-add event is triggered separately for each task added
|
# The on-add event is triggered separately for each task added
|
||||||
|
|
||||||
# Input:
|
# Input:
|
||||||
# - A line of JSON for the task added
|
# - line of JSON for the task added
|
||||||
read new_task
|
|
||||||
|
|
||||||
# Processing goes here
|
|
||||||
|
|
||||||
# Output:
|
# Output:
|
||||||
# - all emitted JSON lines must be fully-formed tasks
|
# - all emitted JSON lines are added/modified as tasks, if the exit code is
|
||||||
# - all emitted non-JSON lines are considered feedback messages
|
# zero, otherwise ignored.
|
||||||
echo on-add
|
# - minimal new task: {"description":"Buy milk"}
|
||||||
|
# - to modify a task include complete JSON
|
||||||
|
# - all emitted non-JSON lines are considered feedback messages if the exit
|
||||||
|
# code is zero, otherwise they are considerederrors.
|
||||||
|
|
||||||
# Exit:
|
read new_task
|
||||||
# 0 Means: - all emitted JSON lines are added/modified
|
|
||||||
# - all emitted non-JSON lines become footnote entries
|
echo $new_task
|
||||||
# non-0 Means: - all emitted JSON lines are ignored
|
echo 'on-add'
|
||||||
# - all emitted non-JSON lines become error entries
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# The on-exit event is triggered once, after all processing is complete
|
# The on-exit event is triggered once, after all processing is complete, i.e.
|
||||||
|
# last
|
||||||
|
|
||||||
# Input:
|
# Input:
|
||||||
# - A read-only line of JSON for each task added/modified
|
# - read-only line of JSON for each task added/modified
|
||||||
|
|
||||||
# Processing goes here
|
|
||||||
|
|
||||||
# Output:
|
# Output:
|
||||||
# - all emitted non-JSON lines are considered feedback messages
|
# - any emitted JSON is ignored
|
||||||
# - The onExit event occurs too late to allow any changes, so the input is not
|
# - all emitted non-JSON lines are considered feedback messages if the exit
|
||||||
# to be modified
|
# code is zero, otherwise they are considerederrors.
|
||||||
echo on-exit
|
|
||||||
|
|
||||||
# Exit:
|
while read modified_task
|
||||||
# 0 Means: - all emitted non-JSON lines become footnote entries
|
do
|
||||||
# non-0 Means: - all emitted non-JSON lines become error entries
|
# Scan task
|
||||||
|
done
|
||||||
|
|
||||||
|
echo 'on-exit'
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# The on-launch event is triggered once, after initialization, before an
|
# The on-launch event is triggered once, after initialization, before any
|
||||||
# processing occurs
|
# processing occurs, i.e first
|
||||||
|
|
||||||
# No input
|
# Input:
|
||||||
|
# - none
|
||||||
# Processing goes here
|
|
||||||
|
|
||||||
# Output:
|
# Output:
|
||||||
# - all emitted JSON lines must be fully-formed tasks
|
# - all emitted JSON lines are added/modified as tasks, if the exit code is
|
||||||
# - all emitted non-JSON lines are considered feedback messages
|
# zero, otherwise ignored.
|
||||||
echo on-launch
|
# - minimal new task: {"description":"Buy milk"}
|
||||||
|
# - to modify a task include complete JSON
|
||||||
|
# - all emitted non-JSON lines are considered feedback messages if the exit
|
||||||
|
# code is zero, otherwise they are considerederrors.
|
||||||
|
|
||||||
# Exit:
|
echo 'on-launch'
|
||||||
# 0 Means: - all emitted JSON lines are added/modified
|
|
||||||
# - all emitted non-JSON lines become footnote entries
|
|
||||||
# non-0 Means: - all emitted JSON lines are ignored
|
|
||||||
# - all emitted non-JSON lines become error entries
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
|
@ -3,22 +3,20 @@
|
||||||
# The on-modify event is triggered separately for each task added or modified
|
# The on-modify event is triggered separately for each task added or modified
|
||||||
|
|
||||||
# Input:
|
# Input:
|
||||||
# - A line of JSON for the original task
|
# - line of JSON for the original task
|
||||||
# - A line of JSON for the modified task
|
# - line of JSON for the modified task, the diff being the modification
|
||||||
|
|
||||||
|
# Output:
|
||||||
|
# - all emitted JSON lines are added/modified as tasks, if the exit code is
|
||||||
|
# zero, otherwise ignored.
|
||||||
|
# - minimal new task: {"description":"Buy milk"}
|
||||||
|
# - to modify a task include complete JSON
|
||||||
|
# - all emitted non-JSON lines are considered feedback messages if the exit
|
||||||
|
# code is zero, otherwise they are considerederrors.
|
||||||
|
|
||||||
read original_task
|
read original_task
|
||||||
read modified_task
|
read modified_task
|
||||||
|
|
||||||
# Processing goes here
|
echo $modified_task
|
||||||
|
echo 'on-modify'
|
||||||
# Output:
|
|
||||||
# - all emitted JSON lines must be fully-formed tasks
|
|
||||||
# - all emitted non-JSON lines are considered feedback messages
|
|
||||||
echo on-modify
|
|
||||||
|
|
||||||
# Exit:
|
|
||||||
# 0 Means: - all emitted JSON lines are added/modified
|
|
||||||
# - all emitted non-JSON lines become footnote entries
|
|
||||||
# non-0 Means: - all emitted JSON lines are ignored
|
|
||||||
# - all emitted non-JSON lines become error entries
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue