aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-01-02 15:32:05 -0500
committerAdam Harrison <adamdharrison@gmail.com>2023-01-02 15:32:05 -0500
commit588ff8bf959e3accfeb455291686a61f06cbd948 (patch)
tree4c1e8c0801cc6e23ac579298324878a33f673637 /src
parent682054104db9e055ad47887753a7e0cdb726e0eb (diff)
downloadlite-xl-plugin-manager-588ff8bf959e3accfeb455291686a61f06cbd948.tar.gz
lite-xl-plugin-manager-588ff8bf959e3accfeb455291686a61f06cbd948.zip
Finished up table command.
Diffstat (limited to 'src')
-rw-r--r--src/lpm.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index 493dc23..1c40343 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -1781,10 +1781,22 @@ in any circumstance unless explicitly supplied.
local descriptions = common.map(plugins, function(e) return e.description or "" end)
local max_description = math.max(table.unpack(common.map(descriptions, function(e) return #e end)))
local max_name = math.max(table.unpack(common.map(names, function(e) return #e end)))
- print("| Plugin" .. string.rep(" ", max_name - 6) .. " | Description" .. string.rep(" ", max_description - 11) .. " |")
- print("| :" .. string.rep("-", max_name-1) .. " | :" .. string.rep("-", max_description - 1) .. " |")
+ local t = { }
+ table.insert(t, "| Plugin" .. string.rep(" ", max_name - 6) .. " | Description" .. string.rep(" ", max_description - 11) .. " |")
+ table.insert(t, "| :" .. string.rep("-", max_name-1) .. " | :" .. string.rep("-", max_description - 1) .. " |")
for i = 1, #plugins do
- print("| " .. names[i] .. string.rep(" ", max_name - #names[i]) .. " | " .. descriptions[i] .. string.rep(" ", max_description - #descriptions[i]) .. " |")
+ table.insert(t, "| " .. names[i] .. string.rep(" ", max_name - #names[i]) .. " | " .. descriptions[i] .. string.rep(" ", max_description - #descriptions[i]) .. " |")
+ end
+ if ARGS[4] then
+ local file = {}
+ for line in io.lines(ARGS[4]) do
+ if not line:find("^|.*") then
+ table.insert(file, line)
+ end
+ end
+ io.open(ARGS[4], "wb"):write(table.concat(file, "\n") .. "\n" .. table.concat(t, "\n") .. "\n")
+ else
+ print(table.concat(t, "\n"))
end
os.exit(0)
end