diff options
Diffstat (limited to 'src/luarocks/command_line.lua')
-rw-r--r-- | src/luarocks/command_line.lua | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index d08ffdfe..9e499fc2 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -4,9 +4,9 @@ module("luarocks.command_line", package.seeall) | |||
4 | 4 | ||
5 | local util = require("luarocks.util") | 5 | local util = require("luarocks.util") |
6 | local cfg = require("luarocks.cfg") | 6 | local cfg = require("luarocks.cfg") |
7 | local fs = require("luarocks.fs") | ||
8 | local path = require("luarocks.path") | 7 | local path = require("luarocks.path") |
9 | local dir = require("luarocks.dir") | 8 | local dir = require("luarocks.dir") |
9 | local deps = require("luarocks.deps") | ||
10 | 10 | ||
11 | --- Display an error message and exit. | 11 | --- Display an error message and exit. |
12 | -- @param message string: The error message. | 12 | -- @param message string: The error message. |
@@ -50,6 +50,10 @@ function run_command(...) | |||
50 | if flags["only-from"] then flags["only-server"] = flags["only-from"] end | 50 | if flags["only-from"] then flags["only-server"] = flags["only-from"] end |
51 | if flags["only-sources-from"] then flags["only-sources"] = flags["only-sources-from"] end | 51 | if flags["only-sources-from"] then flags["only-sources"] = flags["only-sources-from"] end |
52 | if flags["to"] then flags["tree"] = flags["to"] end | 52 | if flags["to"] then flags["tree"] = flags["to"] end |
53 | if flags["nodeps"] then | ||
54 | flags["deps-mode"] = "none" | ||
55 | table.insert(args, "--deps-mode=none") | ||
56 | end | ||
53 | 57 | ||
54 | cfg.flags = flags | 58 | cfg.flags = flags |
55 | 59 | ||
@@ -83,11 +87,16 @@ function run_command(...) | |||
83 | if cfg.local_by_default then | 87 | if cfg.local_by_default then |
84 | flags["local"] = true | 88 | flags["local"] = true |
85 | end | 89 | end |
90 | |||
91 | if flags["deps-mode"] and not deps.check_deps_mode_flag(flags["deps-mode"]) then | ||
92 | die("Invalid entry for --deps-mode.") | ||
93 | end | ||
86 | 94 | ||
87 | if flags["tree"] then | 95 | if flags["tree"] then |
88 | if flags["tree"] == true then | 96 | if flags["tree"] == true or flags["tree"] == "" then |
89 | die("Argument error: use --tree=<path>") | 97 | die("Argument error: use --tree=<path>") |
90 | end | 98 | end |
99 | local fs = require("luarocks.fs") | ||
91 | local root_dir = fs.absolute_name(flags["tree"]) | 100 | local root_dir = fs.absolute_name(flags["tree"]) |
92 | path.use_tree(root_dir) | 101 | path.use_tree(root_dir) |
93 | elseif flags["local"] then | 102 | elseif flags["local"] then |
@@ -136,6 +145,12 @@ function run_command(...) | |||
136 | end | 145 | end |
137 | 146 | ||
138 | if commands[command] then | 147 | if commands[command] then |
148 | -- TODO the interface of run should be modified, to receive the | ||
149 | -- flags table and the (possibly unpacked) nonflags arguments. | ||
150 | -- This would remove redundant parsing of arguments. | ||
151 | -- I'm not changing this now to avoid messing with the run() | ||
152 | -- interface, which I know some people use (even though | ||
153 | -- I never published it as a public API...) | ||
139 | local xp, ok, err = xpcall(function() return commands[command].run(unpack(args)) end, function(err) | 154 | local xp, ok, err = xpcall(function() return commands[command].run(unpack(args)) end, function(err) |
140 | die(debug.traceback("LuaRocks "..cfg.program_version | 155 | die(debug.traceback("LuaRocks "..cfg.program_version |
141 | .." bug (please report at luarocks-developers@lists.sourceforge.net).\n" | 156 | .." bug (please report at luarocks-developers@lists.sourceforge.net).\n" |