commit 02cab39e477ab2db595163f51502afc542678808 Author: DarkWiiPlayer Date: Tue Apr 2 14:53:17 2024 +0200 ✨ Initial Commit ✨ diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..e69de29 diff --git a/src/taskwarrior.lua b/src/taskwarrior.lua new file mode 100644 index 0000000..ce69d83 --- /dev/null +++ b/src/taskwarrior.lua @@ -0,0 +1,23 @@ +local json = require "cjson" + +local taskwarrior = {} + +local function shellescape(str) + return "'"..str:gsub([[']], [['"'"']]).."'" +end + +function taskwarrior.import(...) + local filters = {...} + for i, filter in ipairs(filters) do + filters[i] = shellescape(filter) + end + return json.decode(io.popen("task "..table.concat(filters, " ").." export"):read("*a")) +end + +function taskwarrior.export(items) + local handle = assert(io.popen("task import")) + handle:write(json.encode(items)) + handle:close() +end + +return taskwarrior diff --git a/taskwarrior-dev-1.rockspec b/taskwarrior-dev-1.rockspec new file mode 100644 index 0000000..ff6ca57 --- /dev/null +++ b/taskwarrior-dev-1.rockspec @@ -0,0 +1,15 @@ +package = "taskwarrior" +version = "dev-1" +source = { + url = "git+https://git.but.gay/darkwiiplayer/taskwarrior-lua" +} +description = { + homepage = "https://git.but.gay/darkwiiplayer/taskwarrior-lua", + license = "Unlicense" +} +build = { + type = "builtin", + modules = { + taskwarrior = "src/taskwarrior.lua" + } +}