- Tweaks to the Lua and extension API.  Note that this is a documentation-only
  change, meaning the design is being honed.  No support exists yet.
This commit is contained in:
Paul Beckingham
2012-01-15 11:39:53 -05:00
parent 15030599fd
commit 15d25d4fdf
5 changed files with 10 additions and 13 deletions

View File

@@ -21,13 +21,6 @@ function usage ()
return 'task random' return 'task random'
end end
-- Arguments: None
-- Returns: Valid Taskwarrior BNF, minimally defining a production rule that
-- has the same name as the command itself
function syntax ()
return 'random ::= "random" ;'
end
-- Arguments: None -- Arguments: None
-- Returns: 1 --> command does not modify data -- Returns: 1 --> command does not modify data
-- 0 --> command modifies data -- 0 --> command modifies data

View File

@@ -18,6 +18,9 @@ end
-- Arguments: The DOM reference to evaluate -- Arguments: The DOM reference to evaluate
-- Returns: The value from the DOM lookup -- Returns: The value from the DOM lookup
function lookup (name) function lookup (name)
return 1.23 -- Fake load average if name == 'system.load.average'
then
return 1.23 -- Fake load average
end
end end

View File

@@ -23,7 +23,7 @@ end
-- Arguments: None -- Arguments: None
-- Returns: 0 --> success only -- Returns: 0 --> success only
function goodbye () function execute ()
print ('Goodbye.') print ('Goodbye.')
end end

View File

@@ -24,7 +24,7 @@ end
-- Arguments: None -- Arguments: None
-- Returns: 1 --> failure -- Returns: 1 --> failure
-- 0 --> success -- 0 --> success
function encourage () function execute (uuid)
-- Only provide encouragement if the verbosity settings allow it. -- Only provide encouragement if the verbosity settings allow it.
verbosity = task_get ('rc.verbose') verbosity = task_get ('rc.verbose')
if string.find (verbosity, 'encourage') ~= nil if string.find (verbosity, 'encourage') ~= nil

View File

@@ -45,7 +45,8 @@ end
-- Arguments: Raw data -- Arguments: Raw data
-- Returns: Formatted data -- Returns: Formatted data
-- Note: Shown here is a pass-through format, doing no formatting. This is -- Note: Shown here is a pass-through format, doing no formatting. This is
-- the default behavior if the format function is not implemented. -- also the default behavior if the format function is not
-- implemented.
function format (value) function format (value)
return value return value
end end
@@ -53,8 +54,8 @@ end
-- Arguments: Value -- Arguments: Value
-- Returns: Urgency Term -- Returns: Urgency Term
-- Note: Should reference rc.urgency.<field>.coefficient -- Note: Should reference rc.urgency.<field>.coefficient
function urgency (value) function urgency (uuid)
coefficient = task_get ('urgency.priority.coefficient') coefficient = task_get ('rc.urgency.priority.coefficient')
-- TODO Urgency calculation here -- TODO Urgency calculation here