diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/show.lua | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index 0f29e468..ae41a513 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua | |||
| @@ -90,6 +90,16 @@ function show.pick_installed_rock(name, version, tree) | |||
| 90 | return name, version, repo, repo_url | 90 | return name, version, repo, repo_url |
| 91 | end | 91 | end |
| 92 | 92 | ||
| 93 | local function installed_rock_label(name, tree) | ||
| 94 | local installed, version | ||
| 95 | if cfg.rocks_provided[name] then | ||
| 96 | installed, version = true, cfg.rocks_provided[name] | ||
| 97 | else | ||
| 98 | installed, version = show.pick_installed_rock(name, nil, tree) | ||
| 99 | end | ||
| 100 | return installed and "(using "..version..")" or "(missing)" | ||
| 101 | end | ||
| 102 | |||
| 93 | --- Driver function for "show" command. | 103 | --- Driver function for "show" command. |
| 94 | -- @param name or nil: an existing package name. | 104 | -- @param name or nil: an existing package name. |
| 95 | -- @param version string or nil: a version may also be passed. | 105 | -- @param version string or nil: a version may also be passed. |
| @@ -145,10 +155,26 @@ function show.run(...) | |||
| 145 | util.printout("\t"..mod.." ("..path.which(mod, filename, name, version, repo, manifest)..")") | 155 | util.printout("\t"..mod.." ("..path.which(mod, filename, name, version, repo, manifest)..")") |
| 146 | end | 156 | end |
| 147 | end | 157 | end |
| 148 | if next(minfo.dependencies) then | 158 | local direct_deps = {} |
| 159 | if #rockspec.dependencies > 0 then | ||
| 149 | util.printout() | 160 | util.printout() |
| 150 | util.printout("Depends on:") | 161 | util.printout("Depends on:") |
| 151 | util.printout("\t"..keys_as_string(minfo.dependencies, "\n\t")) | 162 | for _, dep in ipairs(rockspec.dependencies) do |
| 163 | direct_deps[dep.name] = true | ||
| 164 | util.printout("\t"..deps.show_dep(dep).." "..installed_rock_label(dep.name, flags["tree"])) | ||
| 165 | end | ||
| 166 | end | ||
| 167 | local has_indirect_deps | ||
| 168 | for dep_name in util.sortedpairs(minfo.dependencies) do | ||
| 169 | if not direct_deps[dep_name] then | ||
| 170 | if not has_indirect_deps then | ||
| 171 | util.printout() | ||
| 172 | util.printout("Indirectly pulling:") | ||
| 173 | has_indirect_deps = true | ||
| 174 | end | ||
| 175 | |||
| 176 | util.printout("\t"..dep_name.." "..installed_rock_label(dep_name, flags["tree"])) | ||
| 177 | end | ||
| 152 | end | 178 | end |
| 153 | util.printout() | 179 | util.printout() |
| 154 | end | 180 | end |
