Add doc annotations
This commit is contained in:
parent
02cab39e47
commit
91c7d26c48
1 changed files with 10 additions and 0 deletions
|
@ -2,10 +2,18 @@ local json = require "cjson"
|
|||
|
||||
local taskwarrior = {}
|
||||
|
||||
--- @param str string
|
||||
--- @return string
|
||||
local function shellescape(str)
|
||||
return "'"..str:gsub([[']], [['"'"']]).."'"
|
||||
end
|
||||
|
||||
|
||||
--- @alias Task table
|
||||
|
||||
--- Imports all tasks from Taskwarrior according to filters if given
|
||||
--- @param ... string Taskwarrior filters as individual strings
|
||||
--- @return Task[] tasks Sequence listing all tasks
|
||||
function taskwarrior.import(...)
|
||||
local filters = {...}
|
||||
for i, filter in ipairs(filters) do
|
||||
|
@ -14,6 +22,8 @@ function taskwarrior.import(...)
|
|||
return json.decode(io.popen("task "..table.concat(filters, " ").." export"):read("*a"))
|
||||
end
|
||||
|
||||
--- Export tasks back into taskwarrior using the import command
|
||||
--- @param items Task[] Sequence of tasks to import
|
||||
function taskwarrior.export(items)
|
||||
local handle = assert(io.popen("task import"))
|
||||
handle:write(json.encode(items))
|
||||
|
|
Loading…
Reference in a new issue