diff options
| author | ruki <[email protected]> | 2025-11-14 23:29:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-14 23:29:05 +0800 |
| commit | e4617488a56abbd89c24be114e8f7ae36da289e8 (patch) | |
| tree | 10e8023214ec25aad7065ba3004dc7c3a4bacfb0 /xmake/plugins/show/info/basic.lua | |
| parent | 31cab9106eeb43897e641ae80d5557d3b24c35f3 (diff) | |
enable pretty output for xmake show
Diffstat (limited to 'xmake/plugins/show/info/basic.lua')
| -rw-r--r-- | xmake/plugins/show/info/basic.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/xmake/plugins/show/info/basic.lua b/xmake/plugins/show/info/basic.lua index a08b47d3a..47b0f72e7 100644 --- a/xmake/plugins/show/info/basic.lua +++ b/xmake/plugins/show/info/basic.lua @@ -128,13 +128,20 @@ function main() config.load() - local opt = {json = option.get("json")} + local opt = { + json = option.get("json"), + pretty = option.get("pretty") + } local result = opt.json and {} or nil result = _show_xmake_info(opt, result) result = _show_project_info(opt, result) if opt.json then - print(json.encode(result or {})) + local json_opt + if opt.pretty then + json_opt = {pretty = true} + end + print(json.encode(result or {}, json_opt)) end end |
