From 6c7dfb00fa6d097319630fcc38123c30a34d1784 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 12 Jul 2019 17:05:11 -0300 Subject: which: report error on missing argument --- src/luarocks/cmd/which.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/luarocks/cmd/which.lua b/src/luarocks/cmd/which.lua index 0116fdb8..89e6db56 100644 --- a/src/luarocks/cmd/which.lua +++ b/src/luarocks/cmd/which.lua @@ -17,6 +17,9 @@ that module by luarocks.loader, like "/usr/local/lua/]]..cfg.lua_version..[[/foo --- Driver function for "lua" command. -- @return boolean This function terminates the interpreter. function which_cmd.command(_, modname) + if modname == nil then + return nil, "Missing module name. " .. util.see_help("which") + end local pathname, rock_name, rock_version = loader.which(modname) if not pathname then return nil, "Module '" .. modname .. "' not found by luarocks.loader." -- cgit v1.2.3-55-g6feb