diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-01 16:53:00 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-01 22:54:08 -0300 |
commit | cba926d01b56f88266e7eefff9b58fc4562bbdfb (patch) | |
tree | eb30a31c7db91e5db4ffe481fa2f9cce4d17e603 /src | |
parent | bb97bdc4aa7f8efa901e451f6c2d4a9a33902ab7 (diff) | |
download | luarocks-cba926d01b56f88266e7eefff9b58fc4562bbdfb.tar.gz luarocks-cba926d01b56f88266e7eefff9b58fc4562bbdfb.tar.bz2 luarocks-cba926d01b56f88266e7eefff9b58fc4562bbdfb.zip |
cmd: process --version only after cfg.init
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/cmd.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua index 9639fd7d..53e0c60a 100644 --- a/src/luarocks/cmd.lua +++ b/src/luarocks/cmd.lua | |||
@@ -327,12 +327,7 @@ function cmd.run_command(description, commands, ...) | |||
327 | end | 327 | end |
328 | 328 | ||
329 | local command | 329 | local command |
330 | if flags["version"] then | 330 | if flags["help"] or #nonflags == 0 then |
331 | util.printout(program.." "..cfg.program_version) | ||
332 | util.printout(description) | ||
333 | util.printout() | ||
334 | os.exit(cmd.errorcodes.OK) | ||
335 | elseif flags["help"] or #nonflags == 0 then | ||
336 | command = "help" | 331 | command = "help" |
337 | else | 332 | else |
338 | command = table.remove(nonflags, 1) | 333 | command = table.remove(nonflags, 1) |
@@ -362,6 +357,13 @@ function cmd.run_command(description, commands, ...) | |||
362 | 357 | ||
363 | fs.init() | 358 | fs.init() |
364 | 359 | ||
360 | if flags["version"] then | ||
361 | util.printout(program.." "..cfg.program_version) | ||
362 | util.printout(description) | ||
363 | util.printout() | ||
364 | os.exit(cmd.errorcodes.OK) | ||
365 | end | ||
366 | |||
365 | if flags["verbose"] then | 367 | if flags["verbose"] then |
366 | cfg.verbose = true | 368 | cfg.verbose = true |
367 | fs.verbose() | 369 | fs.verbose() |