From 1f673c158867dffbf4edb78909fa87fbb02fc2e5 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 18 Apr 2026 22:02:06 +0800 Subject: improve show test --- tests/plugins/show/test.lua | 8 ++++---- xmake/plugins/show/xmake.lua | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/plugins/show/test.lua b/tests/plugins/show/test.lua index 451b13ade..cac268c96 100644 --- a/tests/plugins/show/test.lua +++ b/tests/plugins/show/test.lua @@ -17,7 +17,7 @@ function test_depgraph_json(t) end function test_depgraph_json_for_single_target(t) - local outdata = os.iorunv("xmake", {"show", "--info=depgraph", "--target=app", "--json", }) + local outdata = os.iorunv("xmake", {"show", "--info=depgraph", "--target=app", "--json"}) local graph = json.decode(outdata) t:are_equal(graph.root_targets, {"app"}) @@ -31,7 +31,7 @@ function test_depgraph_json_for_single_target(t) end function test_depgraph_tree(t) - local outdata = os.iorunv("xmake", {"show", "--info=depgraph", }) + local outdata = os.iorunv("xmake", {"show", "--info=depgraph"}) t:require(outdata:find("app", 1, true)) t:require(outdata:find("core", 1, true)) t:require(outdata:find("ui", 1, true)) @@ -40,7 +40,7 @@ function test_depgraph_tree(t) end function test_depgraph_dot(t) - local outdata = os.iorunv("xmake", {"show", "--info=depgraph", "--dot", }) + local outdata = os.iorunv("xmake", {"show", "--info=depgraph", "--dot"}) t:require(outdata:find("digraph {", 1, true)) t:require(outdata:find('"core"', 1, true)) t:require(outdata:find('"ui" -> "core"', 1, true)) @@ -50,7 +50,7 @@ function test_depgraph_dot(t) end function test_depgraph_dot_for_single_target(t) - local outdata = os.iorunv("xmake", {"show", "--info=depgraph", "--target=ui", "--dot", }) + local outdata = os.iorunv("xmake", {"show", "--info=depgraph", "--target=ui", "--dot"}) t:require(outdata:find("digraph {", 1, true)) t:require(outdata:find('"core"', 1, true)) t:require(outdata:find('"ui" -> "core"', 1, true)) diff --git a/xmake/plugins/show/xmake.lua b/xmake/plugins/show/xmake.lua index de7a5a1c5..6d040da92 100644 --- a/xmake/plugins/show/xmake.lua +++ b/xmake/plugins/show/xmake.lua @@ -32,8 +32,14 @@ task("show") {'g', "group", "kv", nil, "Filter targets by the given group name."}, {nil, "json", "k", false, "Show information with json format."}, {nil, "pretty", "k", false, "Enable pretty formatted json output."}, - {nil, "dot", "k", false, "Output dependency graph in graphviz DOT format."}, + {nil, "dot", "k", false, "Output dependency graph in graphviz DOT format (only for --info=depgraph)."}, {'i', "info", "kv", nil, "Show the given information.", + "e.g.", + " - xmake show --info=depgraph", + " - xmake show --info=depgraph --target=app", + " - xmake show --info=depgraph --json --pretty", + " - xmake show --info=depgraph --dot", + "values:", values = function (complete, opt) return import("list").infos() end}, -- cgit v1.3.1