mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
33 lines
677 B
Text
33 lines
677 B
Text
$
|
|
$ # Taskwarrior now has Lua 5.1.4 built in.
|
|
$
|
|
$ task version
|
|
$ cat > hooks.lua
|
|
function foo ()
|
|
print ("Hello from Lua")
|
|
return 0, nil
|
|
end
|
|
^D
|
|
$
|
|
$ # Taskwarrior can call into Lua at many points during execution.
|
|
$ # This one is called immediately before taskwarrior quits.
|
|
$
|
|
$ task rc.hook.pre-exit=~/hooks.lua:foo version
|
|
$
|
|
$ # While taskwarrior is calling Lua code, the Lua can also call
|
|
$ # back into a taskwarrior API, for information.
|
|
$
|
|
$ cat > hooks.lua
|
|
function foo ()
|
|
print "Lua version is " .. task_lua_version ())
|
|
print "Taskwarrior version is " .. task_version ())
|
|
return 0, nil
|
|
end
|
|
^D
|
|
$
|
|
$ cat >> .taskrc
|
|
hook.pre-exit=~/hooks.lua:foo
|
|
^D
|
|
$
|
|
$ task version
|
|
|