taskwarrior/scripts/extensions/command.lua
Paul Beckingham bc756637da Commands
- Implemented CmdHelp object that replaces the report.cpp longUsage
  function, and builds the output dynamically from other Command
  objects.  This is also why the help text right now is very short,
  as only a few commands are migrated.
- Obsoleted longUsage function.
- Updated task.1 man page with 'execute' command details.
- Modified command.lua sample to include command usage.
- Removed "help" from old Context::dispatch, which means "help" is
  the first migrated command.
- Added usage and description to all Cmd* objects.
- Implemented Command::usage and Command::description as base class
  methods that simply return data that is specified by the derived
  classes.
2011-05-15 01:14:13 -04:00

52 lines
1.4 KiB
Lua

-- 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
'GPLv2', -- License
'© 2011, Göteborg Bit Factory' -- Copyright
end
-- Arguments: None
-- Returns: Usage syntax, such as "task random"
function usage ()
return 'task random'
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
-- 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