diff options
| author | ruki <[email protected]> | 2026-04-20 17:35:48 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-20 17:35:48 +0800 |
| commit | 55f8d448564f7cc198edb4db506ec7c18ca8f0f6 (patch) | |
| tree | 6822b239d43091d20037a99b6ffa9fd7e449f1db /xmake/plugins/show/info/basic.lua | |
| parent | 3a1b4e1719ba50b259afa27b450f06c39548003d (diff) | |
| parent | 4e3f6b16db88b9c1afad898a7f5dfeaecdfd0f27 (diff) | |
Merge pull request #7490 from xmake-io/show
Export target dependency graph as json/dot
Diffstat (limited to 'xmake/plugins/show/info/basic.lua')
| -rw-r--r-- | xmake/plugins/show/info/basic.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/xmake/plugins/show/info/basic.lua b/xmake/plugins/show/info/basic.lua index 4ad14fe98..8a29dc2c0 100644 --- a/xmake/plugins/show/info/basic.lua +++ b/xmake/plugins/show/info/basic.lua @@ -128,8 +128,13 @@ function main() config.load() + -- 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 local opt = { - json = option.get("json"), + json = format == "json", pretty = option.get("pretty") } local result = opt.json and {} or nil @@ -138,9 +143,9 @@ function main() result = _show_project_info(opt, result) if opt.json then - 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(result or {}, json_opt)) end |
