summaryrefslogtreecommitdiff
path: root/xmake/plugins/show/main.lua
diff options
context:
space:
mode:
authorAkaps316 <[email protected]>2026-04-11 21:28:37 +0530
committerruki <[email protected]>2026-04-20 09:35:36 +0800
commitf2179c9ccf0d199af1ea2c3320945f20a2f12f6e (patch)
treec173df0a373be2a713eed0802151af8404baff0a /xmake/plugins/show/main.lua
parent8512dce671af24d2f293728bfdb9e65f81e5ed38 (diff)
Address code review feedback by waruqi: refactor parameter parsing, remove local functions, and use simpler test env
Diffstat (limited to 'xmake/plugins/show/main.lua')
-rw-r--r--xmake/plugins/show/main.lua24
1 files changed, 14 insertions, 10 deletions
diff --git a/xmake/plugins/show/main.lua b/xmake/plugins/show/main.lua
index 2b337b13e..7e04b7a43 100644
--- a/xmake/plugins/show/main.lua
+++ b/xmake/plugins/show/main.lua
@@ -32,16 +32,20 @@ function main()
local listname = option.get("list")
if listname then
return _show_list(listname)
- elseif option.get("target_graph") then
- return assert(import("info.target_graph", {try = true, anonymous = true}))(option.get("target"))
- else
- -- show the information of the given object
- for _, filepath in ipairs(os.files(path.join(os.scriptdir(), "info", "*.lua"))) do
- local name = path.basename(filepath)
- if option.get(name) then
- local show_info = assert(import("info." .. name, {try = true, anonymous = true}), "unknown option name(%s)", name)
- return show_info(option.get(name))
- end
+ end
+
+ local infoname = option.get("info")
+ if infoname then
+ local show_info = assert(import("info." .. infoname, {try = true, anonymous = true}), "unknown info name(%s)", infoname)
+ return show_info(option.get("target"))
+ end
+
+ -- fallback to legacy options format
+ for _, filepath in ipairs(os.files(path.join(os.scriptdir(), "info", "*.lua"))) do
+ local name = path.basename(filepath)
+ if option.get(name) then
+ local show_info = assert(import("info." .. name, {try = true, anonymous = true}), "unknown option name(%s)", name)
+ return show_info(option.get(name))
end
end