aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2019-03-14 21:49:29 -0300
committerHisham Muhammad <hisham@gobolinux.org>2019-03-14 23:19:39 -0300
commit26b22259dd5e9380a38e06577345918885eb5707 (patch)
tree57d0efde9770459111db8418119185c16f396eb7 /src
parent1219cb353ead5f88b2417b3c7d86a72a4bd42a2c (diff)
downloadluarocks-26b22259dd5e9380a38e06577345918885eb5707.tar.gz
luarocks-26b22259dd5e9380a38e06577345918885eb5707.tar.bz2
luarocks-26b22259dd5e9380a38e06577345918885eb5707.zip
init: support running from the root directory
Containers often run things from the root directory. This makes the <name> argument mandatory when running `luarocks init` from `/`. See https://github.com/luarocks/luarocks/issues/952#issuecomment-456528919
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cmd/init.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/luarocks/cmd/init.lua b/src/luarocks/cmd/init.lua
index e2dddc09..28c6f5d5 100644
--- a/src/luarocks/cmd/init.lua
+++ b/src/luarocks/cmd/init.lua
@@ -57,6 +57,9 @@ function init.command(flags, name, version)
57 57
58 if not name then 58 if not name then
59 name = dir.base_name(pwd) 59 name = dir.base_name(pwd)
60 if name == "/" then
61 return nil, "When running from the root directory, please specify the <name> argument"
62 end
60 end 63 end
61 64
62 util.printout("Initializing project " .. name .. " ...") 65 util.printout("Initializing project " .. name .. " ...")