diff options
| author | Peter Melnichenko <mpeterval@gmail.com> | 2016-11-12 00:49:36 +0300 |
|---|---|---|
| committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-11-12 00:49:36 +0300 |
| commit | 47530921d71ef34fcd29a631584ca38af0df99d7 (patch) | |
| tree | 35f0bb1d1e4df0b5780f16e84cadc943f5eec15d | |
| parent | 91c1f20bbafdee236f78a93a78c233c833f413e9 (diff) | |
| download | luarocks-47530921d71ef34fcd29a631584ca38af0df99d7.tar.gz luarocks-47530921d71ef34fcd29a631584ca38af0df99d7.tar.bz2 luarocks-47530921d71ef34fcd29a631584ca38af0df99d7.zip | |
List commands in `luarocks show`
| -rw-r--r-- | src/luarocks/cmd/show.lua | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/luarocks/cmd/show.lua b/src/luarocks/cmd/show.lua index ebb515c0..ad48b153 100644 --- a/src/luarocks/cmd/show.lua +++ b/src/luarocks/cmd/show.lua | |||
| @@ -67,6 +67,12 @@ local function installed_rock_label(name, tree) | |||
| 67 | return installed and "(using "..version..")" or "(missing)" | 67 | return installed and "(using "..version..")" or "(missing)" |
| 68 | end | 68 | end |
| 69 | 69 | ||
| 70 | local function print_items(name, version, item_set, item_type, repo) | ||
| 71 | for item_name in util.sortedpairs(item_set) do | ||
| 72 | util.printout("\t"..item_name.." ("..repos.which(name, version, item_type, item_name, repo)..")") | ||
| 73 | end | ||
| 74 | end | ||
| 75 | |||
| 70 | --- Driver function for "show" command. | 76 | --- Driver function for "show" command. |
| 71 | -- @param name or nil: an existing package name. | 77 | -- @param name or nil: an existing package name. |
| 72 | -- @param version string or nil: a version may also be passed. | 78 | -- @param version string or nil: a version may also be passed. |
| @@ -122,13 +128,19 @@ function show.command(flags, name, version) | |||
| 122 | util.printout("Labels: ", table.concat(descript.labels, ", ")) | 128 | util.printout("Labels: ", table.concat(descript.labels, ", ")) |
| 123 | end | 129 | end |
| 124 | util.printout("Installed in: ", path.rocks_tree_to_string(repo)) | 130 | util.printout("Installed in: ", path.rocks_tree_to_string(repo)) |
| 131 | |||
| 132 | if next(minfo.commands) then | ||
| 133 | util.printout() | ||
| 134 | util.printout("Commands: ") | ||
| 135 | print_items(name, version, minfo.commands, "command", repo) | ||
| 136 | end | ||
| 137 | |||
| 125 | if next(minfo.modules) then | 138 | if next(minfo.modules) then |
| 126 | util.printout() | 139 | util.printout() |
| 127 | util.printout("Modules:") | 140 | util.printout("Modules: ") |
| 128 | for mod in util.sortedpairs(minfo.modules) do | 141 | print_items(name, version, minfo.modules, "module", repo) |
| 129 | util.printout("\t"..mod.." ("..repos.which(name, version, "module", mod, repo)..")") | ||
| 130 | end | ||
| 131 | end | 142 | end |
| 143 | |||
| 132 | local direct_deps = {} | 144 | local direct_deps = {} |
| 133 | if #rockspec.dependencies > 0 then | 145 | if #rockspec.dependencies > 0 then |
| 134 | util.printout() | 146 | util.printout() |
