prosodyctl
changeset 10190 520e879a40f2
parent 10188 5655cd9fc8e9
child 10192 dbd9880bf5c6
equal deleted inserted replaced
10189:02d8f475a96d 10190:520e879a40f2
   124 function commands.list(arg)
   124 function commands.list(arg)
   125 	if arg[1] == "--help" then
   125 	if arg[1] == "--help" then
   126 		show_usage([[list]], [[Shows installed rocks]]);
   126 		show_usage([[list]], [[Shows installed rocks]]);
   127 		return 1;
   127 		return 1;
   128 	end
   128 	end
   129 	-- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now
   129 	local operation = "list";
   130 	local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins)
   130 	local tree, mod, dir = check_flags(arg);
   131 	local flag = "--tree="
   131 	if tree then
   132 	-- I'm considering this optional flag comes first
   132 		call_luarocks(operation, mod, dir);
   133 	if arg[1] and arg[1]:sub(1, #flag) == flag then
       
   134 		local dir = arg[1]:match("=(.+)$")
       
   135 		os.execute("luarocks list --tree='"..dir.."'")
       
   136 		return 0;
   133 		return 0;
   137 	else
   134 	else
   138 		os.execute("luarocks list --tree="..installer_plugin_path)
   135 		dir = get_path_custom_plugins(prosody.paths.plugins);
       
   136 		call_luarocks(operation, mod, dir);
   139 		return 0;
   137 		return 0;
   140 	end
   138 	end
   141 end
   139 end
   142 
   140 
   143 function commands.enabled_plugins(arg)
   141 function commands.enabled_plugins(arg)