summaryrefslogtreecommitdiff
path: root/xmake/plugins/show/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/plugins/show/main.lua')
-rw-r--r--xmake/plugins/show/main.lua22
1 files changed, 14 insertions, 8 deletions
diff --git a/xmake/plugins/show/main.lua b/xmake/plugins/show/main.lua
index 9dc4f519a..7e04b7a43 100644
--- a/xmake/plugins/show/main.lua
+++ b/xmake/plugins/show/main.lua
@@ -32,14 +32,20 @@ function main()
local listname = option.get("list")
if listname then
return _show_list(listname)
- 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