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.lua15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua
index 96d7cb11..9cc34c42 100644
--- a/src/luarocks/command_line.lua
+++ b/src/luarocks/command_line.lua
@@ -64,6 +64,9 @@ function command_line.run_command(...)
64 end 64 end
65 local nonflags = { util.parse_flags(unpack(args)) } 65 local nonflags = { util.parse_flags(unpack(args)) }
66 local flags = table.remove(nonflags, 1) 66 local flags = table.remove(nonflags, 1)
67 if flags.ERROR then
68 die(flags.ERROR.." See --help.")
69 end
67 70
68 if flags["from"] then flags["server"] = flags["from"] end 71 if flags["from"] then flags["server"] = flags["from"] end
69 if flags["only-from"] then flags["only-server"] = flags["only-from"] end 72 if flags["only-from"] then flags["only-server"] = flags["only-from"] end
@@ -126,16 +129,10 @@ function command_line.run_command(...)
126 end 129 end
127 130
128 if flags["branch"] then 131 if flags["branch"] then
129 if flags["branch"] == true or flags["branch"] == "" then
130 die("Argument error: use --branch=<branch-name>")
131 end
132 cfg.branch = flags["branch"] 132 cfg.branch = flags["branch"]
133 end 133 end
134 134
135 if flags["tree"] then 135 if flags["tree"] then
136 if flags["tree"] == true or flags["tree"] == "" then
137 die("Argument error: use --tree=<path>")
138 end
139 local named = false 136 local named = false
140 for _, tree in ipairs(cfg.rocks_trees) do 137 for _, tree in ipairs(cfg.rocks_trees) do
141 if type(tree) == "table" and flags["tree"] == tree.name then 138 if type(tree) == "table" and flags["tree"] == tree.name then
@@ -178,17 +175,11 @@ function command_line.run_command(...)
178 cfg.variables.SCRIPTS_DIR = cfg.deploy_bin_dir 175 cfg.variables.SCRIPTS_DIR = cfg.deploy_bin_dir
179 176
180 if flags["server"] then 177 if flags["server"] then
181 if flags["server"] == true then
182 die("Argument error: use --server=<url>")
183 end
184 local protocol, path = dir.split_url(flags["server"]) 178 local protocol, path = dir.split_url(flags["server"])
185 table.insert(cfg.rocks_servers, 1, protocol.."://"..path) 179 table.insert(cfg.rocks_servers, 1, protocol.."://"..path)
186 end 180 end
187 181
188 if flags["only-server"] then 182 if flags["only-server"] then
189 if flags["only-server"] == true then
190 die("Argument error: use --only-server=<url>")
191 end
192 cfg.rocks_servers = { flags["only-server"] } 183 cfg.rocks_servers = { flags["only-server"] }
193 end 184 end
194 185