package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

6 years ago
import("packages", {alias = "get_packages"})
function main(...)
-- get packages
local packages = get_packages()
local tables = {}
local col = 1
local row_max = 0
for _, pkgs in pairs(packages) do
for row, pkg in ipairs(pkgs) do
tables[row] = tables[row] or {}
tables[row][col] = pkg
end
if #pkgs > row_max then
row_max = #pkgs
end
col = col + 1
end
-- generate markdown table
6 years ago
local packages_md = "## All Supported Packages\n\n"
6 years ago
for plat, _ in pairs(packages) do
packages_md = packages_md .. "|" .. plat
6 years ago
end
packages_md = packages_md .. "|\n"
for plat, _ in pairs(packages) do
packages_md = packages_md .. "|" .. (plat:gsub('.', '-'))
end
packages_md = packages_md .. "|\n"
for y = 1, row_max do
for x = 1, col do
local pkg = tables[y][x]
local info = ""
if pkg then
if pkg.generic then
info = pkg.name
6 years ago
else
info = pkg.name .. "(" .. table.concat(pkg.archs, ",") .. ")"
end
end
packages_md = packages_md .. "|" .. info
end
packages_md = packages_md .. "|\n"
end
print(packages_md)
io.writefile(path.join(os.scriptdir(), "..", "PKGLIST.md"), packages_md)
end