Compare commits
No commits in common. "5b7ce8e6f34a5c6fe680c30c65ec2f7102a61b27" and "91c7d26c48886e52d1ac37d99a452c20202a5f01" have entirely different histories.
5b7ce8e6f3
...
91c7d26c48
2 changed files with 4 additions and 16 deletions
|
@ -1,9 +0,0 @@
|
|||
# Taskwarrior Lua
|
||||
|
||||
A simple lua helper to import and export task data to and from taskwarrior using
|
||||
its builtin `import` and `export` commands.
|
||||
|
||||
The `import` function imports data into Lua using `task export` and vice versa.
|
||||
|
||||
The `import` function takes an optional list of filters to pass on to task
|
||||
warrior to limit which tasks are to be updated.
|
|
@ -8,11 +8,8 @@ local function shellescape(str)
|
|||
return "'"..str:gsub([[']], [['"'"']]).."'"
|
||||
end
|
||||
|
||||
--- @class Task
|
||||
--- @field description string
|
||||
--- @field uuid string
|
||||
--- @field due string
|
||||
--- @field status "pending"|"completed"|"deleted"|"waiting"
|
||||
|
||||
--- @alias Task table
|
||||
|
||||
--- Imports all tasks from Taskwarrior according to filters if given
|
||||
--- @param ... string Taskwarrior filters as individual strings
|
||||
|
@ -22,13 +19,13 @@ function taskwarrior.import(...)
|
|||
for i, filter in ipairs(filters) do
|
||||
filters[i] = shellescape(filter)
|
||||
end
|
||||
return json.decode(io.popen("task rc.verbose: "..table.concat(filters, " ").." export"):read("*a"))
|
||||
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 rc.verbose: import"))
|
||||
local handle = assert(io.popen("task import"))
|
||||
handle:write(json.encode(items))
|
||||
handle:close()
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue