taskwarrior/doc/misc/script-hooks-2.txt
Paul Beckingham 44fe227595 Product Name Change
- Converted all (appropriate) uses of 'task' to 'taskwarrior'.
2010-08-21 12:31:00 -04:00

40 lines
788 B
Text

$ # Q: What is a formatting hook?
$ # A: Lua code that modifies taskwarrior 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