From cb952329d34b26df5b592614358f83dbf4f20b28 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 6 Feb 2010 17:09:47 -0500 Subject: [PATCH] Documentation Update - Added latest movie script. --- doc/misc/script-hooks-2.txt | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 doc/misc/script-hooks-2.txt diff --git a/doc/misc/script-hooks-2.txt b/doc/misc/script-hooks-2.txt new file mode 100644 index 000000000..73f2180b6 --- /dev/null +++ b/doc/misc/script-hooks-2.txt @@ -0,0 +1,40 @@ +$ # Q: What is a formatting hook? +$ # A: Lua code that modifies task output at run time. +$ +$ cat > hooks.lua + +-- Make ID not show up +function id (name, value) + return "(shhh - it's a secret)", 0, nil +end + +-- Decorate the UUID +function uuid (name, value) + return '<<<' .. value .. '>>>', 0, nil +end + +^D + +$ # Q: What is a command hook? +$ # A: Lua code that changes the way commands work. +$ +$ cat >> hooks.lua + +-- Disable tags +function notags () + return 1, 'Tags have been disabled' +end + +^D + +$ +$ task config -- hook.format-id ~/demo/hooks.lua:id +$ task config -- hook.format-uuid ~/demo/hooks.lua:uuid +$ task config -- hook.pre-tag ~/demo/hooks.lua:notags +$ task list +$ task add Demonstrate formatting hooks +$ task 1 info +$ task config hooks on +$ task 1 info +$ task 1 +try_to_tag +