diff options
author | Peter Melnichenko <mpeterval@gmail.com> | 2016-11-12 00:49:36 +0300 |
---|---|---|
committer | Peter Melnichenko <mpeterval@gmail.com> | 2017-09-12 18:17:46 +0300 |
commit | 96cca8d544ec0969b2d7faa700f1bcfef0254eea (patch) | |
tree | 23e986d49fdca7be1d1b4c0207ade545e5c5c4d2 | |
parent | 6ef95c8f0a1dfffdefa322b0249fe7f74acec1fa (diff) | |
download | luarocks-96cca8d544ec0969b2d7faa700f1bcfef0254eea.tar.gz luarocks-96cca8d544ec0969b2d7faa700f1bcfef0254eea.tar.bz2 luarocks-96cca8d544ec0969b2d7faa700f1bcfef0254eea.zip |
List commands in `luarocks show`
-rw-r--r-- | src/luarocks/show.lua | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index 8ec6394b..ac6273e0 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua | |||
@@ -69,6 +69,12 @@ local function installed_rock_label(name, tree) | |||
69 | return installed and "(using "..version..")" or "(missing)" | 69 | return installed and "(using "..version..")" or "(missing)" |
70 | end | 70 | end |
71 | 71 | ||
72 | local function print_items(name, version, item_set, item_type, repo) | ||
73 | for item_name in util.sortedpairs(item_set) do | ||
74 | util.printout("\t"..item_name.." ("..repos.which(name, version, item_type, item_name, repo)..")") | ||
75 | end | ||
76 | end | ||
77 | |||
72 | --- Driver function for "show" command. | 78 | --- Driver function for "show" command. |
73 | -- @param name or nil: an existing package name. | 79 | -- @param name or nil: an existing package name. |
74 | -- @param version string or nil: a version may also be passed. | 80 | -- @param version string or nil: a version may also be passed. |
@@ -116,13 +122,19 @@ function show.command(flags, name, version) | |||
116 | util.printout("Homepage: ", descript.homepage) | 122 | util.printout("Homepage: ", descript.homepage) |
117 | end | 123 | end |
118 | util.printout("Installed in: ", path.rocks_tree_to_string(repo)) | 124 | util.printout("Installed in: ", path.rocks_tree_to_string(repo)) |
125 | |||
126 | if next(minfo.commands) then | ||
127 | util.printout() | ||
128 | util.printout("Commands: ") | ||
129 | print_items(name, version, minfo.commands, "command", repo) | ||
130 | end | ||
131 | |||
119 | if next(minfo.modules) then | 132 | if next(minfo.modules) then |
120 | util.printout() | 133 | util.printout() |
121 | util.printout("Modules:") | 134 | util.printout("Modules: ") |
122 | for mod in util.sortedpairs(minfo.modules) do | 135 | print_items(name, version, minfo.modules, "module", repo) |
123 | util.printout("\t"..mod.." ("..repos.which(name, version, "module", mod, repo)..")") | ||
124 | end | ||
125 | end | 136 | end |
137 | |||
126 | local direct_deps = {} | 138 | local direct_deps = {} |
127 | if #rockspec.dependencies > 0 then | 139 | if #rockspec.dependencies > 0 then |
128 | util.printout() | 140 | util.printout() |