summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Weijie <[email protected]>2024-05-30 00:11:45 +0800
committerYao Weijie <[email protected]>2024-05-30 00:11:45 +0800
commit6170240ebc98e155105fc0e6934de276bb92d25d (patch)
treec0f2fe16bfa2efb0423081752c705eb204750d0e
parent5767107d1e7f66288e9b7eebd4272ba443cbffa0 (diff)
fix `xmake show --list=architectures` with `--json` option
-rw-r--r--xmake/plugins/show/lists/architectures.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/plugins/show/lists/architectures.lua b/xmake/plugins/show/lists/architectures.lua
index 8eba152f2..0aecc6e1e 100644
--- a/xmake/plugins/show/lists/architectures.lua
+++ b/xmake/plugins/show/lists/architectures.lua
@@ -22,6 +22,8 @@
import("core.project.project")
import("core.platform.platform")
import("core.base.text")
+import("core.base.option")
+import(".showlist")
-- show all platforms
function main()
@@ -35,6 +37,7 @@ function main()
-- get all architectures
local result = {align = 'l', sep = " "}
+ local json_result = {}
for i, plat in ipairs(plats) do
local archs = try {function () return project.allowed_archs(plat) end}
if archs then
@@ -45,7 +48,12 @@ function main()
end
if archs and #archs > 0 then
table.insert(result, table.join(plat, archs))
+ json_result[plat] = archs
end
end
- print(text.table(result))
+ if option.get("json") then
+ showlist(json_result)
+ else
+ print(text.table(result))
+ end
end