mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 19:03:07 +02:00
Hooks
- Added README describing the hook system. - Corrected hook interface details regarding exit codes.
This commit is contained in:
parent
9e45f5e637
commit
f47054c485
5 changed files with 40 additions and 14 deletions
26
scripts/hooks/README
Normal file
26
scripts/hooks/README
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
Example Hook Scripts
|
||||||
|
|
||||||
|
Hooks are supported in Taskwarrior 2.4.0 and later. Hooks require no
|
||||||
|
configuration, and simply need to exist, in the expected location, with the
|
||||||
|
expected name, with execute permission. If these conditions are met, the hook
|
||||||
|
scripts will be run.
|
||||||
|
|
||||||
|
Expected Location
|
||||||
|
The hooks scripts all reside in one location, which is in a 'hooks'
|
||||||
|
subdirectory, in your ~/.task (or rc.data.location override) directory.
|
||||||
|
|
||||||
|
Expected Name
|
||||||
|
A hook scripts must be named according to which event triggers the script. A
|
||||||
|
script named 'on-add' will be triggered by a task add event. Multiple hook
|
||||||
|
scripts can coexist, and will all be run, in collating sequence. If there are
|
||||||
|
two scripts, named 'on-add-check-for-missing-priority' and 'on-add.x', they
|
||||||
|
are both executed, in the order shown here.
|
||||||
|
|
||||||
|
Expected Permissions
|
||||||
|
A hook script must have execute permission for the user running taskwarrior,
|
||||||
|
otherwise it is skipped.
|
||||||
|
|
||||||
|
Interface
|
||||||
|
Each hook script has a unique interface. This is documented in the example
|
||||||
|
scripts here.
|
||||||
|
|
|
@ -14,9 +14,9 @@ read new_task
|
||||||
echo on-add
|
echo on-add
|
||||||
|
|
||||||
# Exit:
|
# Exit:
|
||||||
# 0 Means: - all emitted JSON lines are added/modified
|
# 0 Means: - all emitted JSON lines are added/modified
|
||||||
# - all emitted non-JSON lines become footnote entries
|
# - all emitted non-JSON lines become footnote entries
|
||||||
# 1 Means: - all emitted JSON lines are ignored
|
# non-0 Means: - all emitted JSON lines are ignored
|
||||||
# - all emitted non-JSON lines become error entries
|
# - all emitted non-JSON lines become error entries
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
echo on-exit
|
echo on-exit
|
||||||
|
|
||||||
# Exit:
|
# Exit:
|
||||||
# 0 Means: - all emitted non-JSON lines become footnote entries
|
# 0 Means: - all emitted non-JSON lines become footnote entries
|
||||||
# 1 Means: - all emitted non-JSON lines become error entries
|
# non-0 Means: - all emitted non-JSON lines become error entries
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
echo on-launch
|
echo on-launch
|
||||||
|
|
||||||
# Exit:
|
# Exit:
|
||||||
# 0 Means: - all emitted JSON lines are added/modified
|
# 0 Means: - all emitted JSON lines are added/modified
|
||||||
# - all emitted non-JSON lines become footnote entries
|
# - all emitted non-JSON lines become footnote entries
|
||||||
# 1 Means: - all emitted JSON lines are ignored
|
# non-0 Means: - all emitted JSON lines are ignored
|
||||||
# - all emitted non-JSON lines become error entries
|
# - all emitted non-JSON lines become error entries
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ read modified_task
|
||||||
echo on-modify
|
echo on-modify
|
||||||
|
|
||||||
# Exit:
|
# Exit:
|
||||||
# 0 Means: - all emitted JSON lines are added/modified
|
# 0 Means: - all emitted JSON lines are added/modified
|
||||||
# - all emitted non-JSON lines become footnote entries
|
# - all emitted non-JSON lines become footnote entries
|
||||||
# 1 Means: - all emitted JSON lines are ignored
|
# non-0 Means: - all emitted JSON lines are ignored
|
||||||
# - all emitted non-JSON lines become error entries
|
# - all emitted non-JSON lines become error entries
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue