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.
 
 
 

48 lines
1.4 KiB

import("packages", {alias = "get_packages"})
function main(...)
-- get packages
local packages = get_packages({onlyhost = true})
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
local packages_md = "## All Supported Packages\n\n"
for plat, _ in pairs(packages) do
packages_md = packages_md .. "|" .. plat
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
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