Extension Mechanism Cleanup

- Cleaned up existing extension debris, in anticipation of the new mechanisms to
  be included in future releases.  This includes install/uninstall and a full
  set of triggers.
This commit is contained in:
Paul Beckingham 2013-01-12 14:29:04 -05:00
parent a736568e68
commit 19cdf25a8f
26 changed files with 10 additions and 913 deletions

View file

@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 2.8)
install (DIRECTORY bash fish vim zsh extensions
install (DIRECTORY bash fish vim zsh
DESTINATION ${TASK_DOCDIR}/scripts)
install (DIRECTORY add-ons
DESTINATION ${TASK_DOCDIR}/scripts

View file

@ -1,45 +0,0 @@
-- Command Extension.
-- Implementing 'random'.
-- Arguments: None
-- Returns: An 8-element list of installation details. Only called once, on
-- installation of the extension.
function install ()
return 'command', -- Type
'random', -- Name
'1.0', -- Version
'Displays a random pending task', -- Description
'Paul Beckingham', -- Author
'paul@beckingham.net', -- Contact
'MIT', -- License
'© 2012, Göteborg Bit Factory' -- Copyright
end
-- Arguments: None
-- Returns: Usage syntax, such as "task random"
function usage ()
return 'task random'
end
-- Arguments: None
-- Returns: 1 --> command does not modify data
-- 0 --> command modifies data
function read_only ()
return true
end
-- Arguments: None
-- Returns: 1 --> command displays task ID
-- 0 --> no ID displayed
function display_id ()
return true
end
-- Arguments: None
-- Returns: 1 --> command failed
-- 0 --> success
function execute (command_line)
task_footnote_message ('Not implemented')
return 1
end

View file

@ -1,26 +0,0 @@
-- DOM Extension.
-- Implementing 'system.load.average'.
-- Arguments: None
-- Returns: An 8-element list of installation details. Only called once, on
-- installation of the extension.
function install ()
return 'dom', -- Type
'system.load.average', -- Name
'1.0', -- Version
'Provides access to system load', -- Description
'Paul Beckingham', -- Author
'paul@beckingham.net', -- Contact
'MIT', -- License
'© 2012, Göteborg Bit Factory' -- Copyright
end
-- Arguments: The DOM reference to evaluate
-- Returns: The value from the DOM lookup
function lookup (name)
if name == 'system.load.average'
then
return 1.23 -- Fake load average
end
end

View file

@ -1,23 +0,0 @@
-- Format Extension.
-- Implementing 'uuid.short'
-- Arguments: None
-- Returns: An 8-element list of installation details. Only called once, on
-- installation of the extension.
function install ()
return 'format', -- Type
'uuid.short', -- Name
'1.0', -- Version
'Provides short formatted UUIDs', -- Description
'Paul Beckingham', -- Author
'paul@beckingham.net', -- Contact
'MIT', -- License
'© 2012, Göteborg Bit Factory' -- Copyright
end
-- Argument: Value to be formatted
-- Returns: Formatted value
function format (value)
return string.sub (value, 0, 8)
end

View file

@ -1,29 +0,0 @@
-- Program Hook Extension.
-- Implementing goodbye message.
-- Arguments: None
-- Returns: An 8-element list of installation details. Only called once, on
-- installation of the extension.
function install ()
return 'program', -- Type
'goodbye', -- Name
'1.0', -- Version
'Simply says goodbye', -- Description
'Paul Beckingham', -- Author
'paul@beckingham.net', -- Contact
'MIT', -- License
'© 2012, Göteborg Bit Factory' -- Copyright
end
-- Arguments: None
-- Returns: String identifying valid program hook
function hook ()
return 'on-exit'
end
-- Arguments: None
-- Returns: 0 --> success only
function execute ()
print ('Goodbye.')
end

View file

@ -1,36 +0,0 @@
-- Task Hook Extension.
-- Implementing encouragement message.
-- Arguments: None
-- Returns: An 8-element list of installation details. Only called once, on
-- installation of the extension.
function install ()
return 'task', -- Type
'encourage', -- Name
'1.0', -- Version
'Positive feedback', -- Description
'Paul Beckingham', -- Author
'paul@beckingham.net', -- Contact
'MIT', -- License
'© 2012, Göteborg Bit Factory' -- Copyright
end
-- Arguments: None
-- Returns: String identifying valid program hook
function hook ()
return 'on-task-complete'
end
-- Arguments: None
-- Returns: 1 --> failure
-- 0 --> success
function execute (uuid)
-- Only provide encouragement if the verbosity settings allow it.
verbosity = task_get ('rc.verbose')
if string.find (verbosity, 'encourage') ~= nil
then
task_footnote_message ('Good work.')
end
return 0
end

View file

@ -1,64 +0,0 @@
-- 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
'MIT', -- License
'© 2012, Göteborg Bit Factory' -- Copyright
end
-- Arguments: None
-- Returns: Data type
function type ()
return 'custom'
end
-- Arguments: None
-- Returns: List of allowable values
function allowed ()
return 'H', 'M', 'L', ''
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
-- also the default behavior if the format function is not
-- implemented.
function format (value)
return value
end
-- Arguments: Value
-- Returns: Urgency Term
-- Note: Should reference rc.urgency.<field>.coefficient
function urgency (uuid)
coefficient = task_get ('rc.urgency.priority.coefficient')
-- TODO Urgency calculation here
return coefficient * 1.0
end