mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Extensions
- Created scripts/extensions/README to describe samples. - Created sample extension scripts of each type.
This commit is contained in:
parent
bac4610580
commit
60a5d271f4
10 changed files with 335 additions and 55 deletions
61
scripts/extensions/uda.lua
Normal file
61
scripts/extensions/uda.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
-- User Defined Attribute Extension.
|
||||
-- Implementing 'priority'.
|
||||
|
||||
-- Arguments: None
|
||||
-- Returns: An 8-element list of installation details. Only called once, on
|
||||
-- installation of the extension.
|
||||
function install ()
|
||||
return 'uda', -- Type
|
||||
'priority', -- Name
|
||||
1.0, -- Version
|
||||
'Implements priority attribute', -- Description
|
||||
'Paul Beckingham', -- Author
|
||||
'paul@beckingham.net', -- Contact
|
||||
'GPLv2', -- License
|
||||
'© 2011, Göteborg Bit Factory' -- Copyright
|
||||
end
|
||||
|
||||
|
||||
-- Arguments: None
|
||||
-- Returns: Data type
|
||||
function type ()
|
||||
return 'custom'
|
||||
end
|
||||
|
||||
-- Arguments: proposed value
|
||||
-- Returns: 1 --> allowed
|
||||
-- 0 --> disallowed
|
||||
function allowed (value)
|
||||
if value == 'H' ||
|
||||
value == 'M' ||
|
||||
value == 'L' ||
|
||||
value == '' then
|
||||
return 1
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Arguments: left and right values to compare
|
||||
-- Returns: 1 --> left < right
|
||||
-- 0 --> left >= right
|
||||
function compare (left, right)
|
||||
if left == 'M' && right == 'H' then
|
||||
return 1
|
||||
elseif left == 'L' && (right == 'H' || right == 'M') then
|
||||
return 1
|
||||
elseif left == '' then
|
||||
return 1
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Arguments: Raw data
|
||||
-- Returns: Formatted data
|
||||
-- Note: Shown here is a pass-through format, doing no formatting. This is
|
||||
-- the default behavior if the format function is not implemented.
|
||||
function format (value)
|
||||
return value
|
||||
end
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue