diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-20 10:42:16 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-31 11:16:09 -0300 |
commit | 3b92924922a21a996adb1312e50dcdf87d1f61f8 (patch) | |
tree | 631467746693ecb375d790ca2bf1f840b5ad84b9 | |
parent | 875238142b573e1bcb27dc15ddd4338084b187ba (diff) | |
download | luarocks-3b92924922a21a996adb1312e50dcdf87d1f61f8.tar.gz luarocks-3b92924922a21a996adb1312e50dcdf87d1f61f8.tar.bz2 luarocks-3b92924922a21a996adb1312e50dcdf87d1f61f8.zip |
list: show tree in list title when using --tree
-rw-r--r-- | spec/list_spec.lua | 2 | ||||
-rw-r--r-- | src/luarocks/cmd/list.lua | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/spec/list_spec.lua b/spec/list_spec.lua index 5a5e363a..e4bb7b45 100644 --- a/spec/list_spec.lua +++ b/spec/list_spec.lua | |||
@@ -40,6 +40,6 @@ describe("LuaRocks list tests #blackbox #b_list", function() | |||
40 | 40 | ||
41 | it("LuaRocks list invalid tree", function() | 41 | it("LuaRocks list invalid tree", function() |
42 | local output = run.luarocks("--tree=/some/invalid/tree list") | 42 | local output = run.luarocks("--tree=/some/invalid/tree list") |
43 | assert(output:find("Installed rocks for Lua "..test_env.lua_version, 1, true)) | 43 | assert(output:find("Rocks installed for Lua "..test_env.lua_version.." in /some/invalid/tree", 1, true)) |
44 | end) | 44 | end) |
45 | end) | 45 | end) |
diff --git a/src/luarocks/cmd/list.lua b/src/luarocks/cmd/list.lua index 102a08f0..5e5cfac8 100644 --- a/src/luarocks/cmd/list.lua +++ b/src/luarocks/cmd/list.lua | |||
@@ -71,8 +71,10 @@ end | |||
71 | function list.command(flags, filter, version) | 71 | function list.command(flags, filter, version) |
72 | local query = queries.new(filter and filter:lower() or "", version, true) | 72 | local query = queries.new(filter and filter:lower() or "", version, true) |
73 | local trees = cfg.rocks_trees | 73 | local trees = cfg.rocks_trees |
74 | local title = "Rocks installed for Lua "..cfg.lua_version | ||
74 | if flags["tree"] then | 75 | if flags["tree"] then |
75 | trees = { flags["tree"] } | 76 | trees = { flags["tree"] } |
77 | title = title .. " in " .. flags["tree"] | ||
76 | end | 78 | end |
77 | 79 | ||
78 | if flags["outdated"] then | 80 | if flags["outdated"] then |
@@ -86,7 +88,7 @@ function list.command(flags, filter, version) | |||
86 | util.warning(err) | 88 | util.warning(err) |
87 | end | 89 | end |
88 | end | 90 | end |
89 | util.title("Installed rocks for Lua "..cfg.lua_version..":", flags["porcelain"]) | 91 | util.title(title, flags["porcelain"]) |
90 | search.print_result_tree(results, flags["porcelain"]) | 92 | search.print_result_tree(results, flags["porcelain"]) |
91 | return true | 93 | return true |
92 | end | 94 | end |