summaryrefslogtreecommitdiff
path: root/xmake/plugins/show/info/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2026-04-20 17:35:48 +0800
committerGitHub <[email protected]>2026-04-20 17:35:48 +0800
commit55f8d448564f7cc198edb4db506ec7c18ca8f0f6 (patch)
tree6822b239d43091d20037a99b6ffa9fd7e449f1db /xmake/plugins/show/info/target.lua
parent3a1b4e1719ba50b259afa27b450f06c39548003d (diff)
parent4e3f6b16db88b9c1afad898a7f5dfeaecdfd0f27 (diff)
Merge pull request #7490 from xmake-io/show
Export target dependency graph as json/dot
Diffstat (limited to 'xmake/plugins/show/info/target.lua')
-rw-r--r--xmake/plugins/show/info/target.lua20
1 files changed, 12 insertions, 8 deletions
diff --git a/xmake/plugins/show/info/target.lua b/xmake/plugins/show/info/target.lua
index e63a51ea7..75f31f9a5 100644
--- a/xmake/plugins/show/info/target.lua
+++ b/xmake/plugins/show/info/target.lua
@@ -363,18 +363,22 @@ function main(name)
-- get target
config.load()
- local opt = {
- json = option.get("json"),
- pretty = option.get("pretty")
- }
+
+ -- support --format=json, with --json/--pretty backward compatibility
+ local format = option.get("format") or "plain"
+ if format == "plain" and option.get("json") then
+ format = "json"
+ end
+
+ assert(name, "please specify the target name, e.g. xmake show --info=target --target=xxx")
local target = assert(check_targetname(name))
local info = _collect_target_info(target)
- if opt.json then
+ if format == "json" then
info.api_entries = nil
- local json_opt
- if opt.pretty then
- json_opt = {pretty = true, orderkeys = true}
+ local json_opt = {pretty = true, orderkeys = true}
+ if option.get("json") and not option.get("pretty") then
+ json_opt = nil
end
print(json.encode(info or {}, json_opt))
else