Mercurial > repo
comparison share/lua/5.2/luarocks/list.lua @ 1132:d137f631bad5
<GreyKnight> (cd luabuild/luarocks-2.0.12; make install)
author | HackBot |
---|---|
date | Fri, 14 Dec 2012 22:24:27 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1131:ff65dfb63263 | 1132:d137f631bad5 |
---|---|
1 | |
2 --- Module implementing the LuaRocks "list" command. | |
3 -- Lists currently installed rocks. | |
4 module("luarocks.list", package.seeall) | |
5 | |
6 local search = require("luarocks.search") | |
7 local cfg = require("luarocks.cfg") | |
8 local util = require("luarocks.util") | |
9 local path = require("luarocks.path") | |
10 | |
11 help_summary = "Lists currently installed rocks." | |
12 help_arguments = "[--porcelain] <filter>" | |
13 help = [[ | |
14 <filter> is a substring of a rock name to filter by. | |
15 | |
16 --porcelain Produce machine-friendly output. | |
17 ]] | |
18 | |
19 --- Driver function for "list" command. | |
20 -- @param filter string or nil: A substring of a rock name to filter by. | |
21 -- @param version string or nil: a version may also be passed. | |
22 -- @return boolean: True if succeeded, nil on errors. | |
23 function run(...) | |
24 local flags, filter, version = util.parse_flags(...) | |
25 local results = {} | |
26 local query = search.make_query(filter and filter:lower() or "", version) | |
27 query.exact_name = false | |
28 local trees = cfg.rocks_trees | |
29 if flags["tree"] then | |
30 trees = { flags["tree"] } | |
31 end | |
32 for _, tree in ipairs(trees) do | |
33 search.manifest_search(results, path.rocks_dir(tree), query) | |
34 end | |
35 util.title("Installed rocks:", flags["porcelain"]) | |
36 search.print_results(results, flags["porcelain"]) | |
37 return true | |
38 end |