aboutsummaryrefslogtreecommitdiff
path: root/src/luarocks/command_line.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/command_line.lua')
-rw-r--r--src/luarocks/command_line.lua18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua
index 50502257..02793c5a 100644
--- a/src/luarocks/command_line.lua
+++ b/src/luarocks/command_line.lua
@@ -15,7 +15,7 @@ local function die(message)
15 15
16 local ok, err = pcall(util.run_scheduled_functions) 16 local ok, err = pcall(util.run_scheduled_functions)
17 if not ok then 17 if not ok then
18 util.printerr("\nLuaRocks "..cfg.program_version.." internal bug (please report at luarocks-developers@lists.luaforge.net):\n"..err) 18 util.printerr("\nLuaRocks "..cfg.program_version.." internal bug (please report at luarocks-developers@lists.sourceforge.net):\n"..err)
19 end 19 end
20 util.printerr("\nError: "..message) 20 util.printerr("\nError: "..message)
21 os.exit(1) 21 os.exit(1)
@@ -33,14 +33,6 @@ local function is_writable(tree)
33 end 33 end
34end 34end
35 35
36local function use_tree(tree)
37 cfg.root_dir = tree
38 cfg.rocks_dir = path.rocks_dir(tree)
39 cfg.deploy_bin_dir = path.deploy_bin_dir(tree)
40 cfg.deploy_lua_dir = path.deploy_lua_dir(tree)
41 cfg.deploy_lib_dir = path.deploy_lib_dir(tree)
42end
43
44--- Main command-line processor. 36--- Main command-line processor.
45-- Parses input arguments and calls the appropriate driver function 37-- Parses input arguments and calls the appropriate driver function
46-- to execute the action requested on the command-line, forwarding 38-- to execute the action requested on the command-line, forwarding
@@ -97,12 +89,12 @@ function run_command(...)
97 die("Argument error: use --to=<path>") 89 die("Argument error: use --to=<path>")
98 end 90 end
99 local root_dir = fs.absolute_name(flags["to"]) 91 local root_dir = fs.absolute_name(flags["to"])
100 use_tree(root_dir) 92 path.use_tree(root_dir)
101 elseif flags["local"] then 93 elseif flags["local"] then
102 use_tree(cfg.home_tree) 94 path.use_tree(cfg.home_tree)
103 else 95 else
104 local trees = cfg.rocks_trees 96 local trees = cfg.rocks_trees
105 use_tree(trees[#trees]) 97 path.use_tree(trees[#trees])
106 end 98 end
107 99
108 if type(cfg.root_dir) == "string" then 100 if type(cfg.root_dir) == "string" then
@@ -142,7 +134,7 @@ function run_command(...)
142 if commands[command] then 134 if commands[command] then
143 local xp, ok, err = xpcall(function() return commands[command].run(unpack(args)) end, function(err) 135 local xp, ok, err = xpcall(function() return commands[command].run(unpack(args)) end, function(err)
144 die(debug.traceback("LuaRocks "..cfg.program_version 136 die(debug.traceback("LuaRocks "..cfg.program_version
145 .." bug (please report at luarocks-developers@lists.luaforge.net).\n" 137 .." bug (please report at luarocks-developers@lists.sourceforge.net).\n"
146 ..err, 2)) 138 ..err, 2))
147 end) 139 end)
148 if xp and (not ok) then 140 if xp and (not ok) then