Changeset

10187:85725e11c509

util.prosodyctl: Added the execute_command function
author João Duarte <jvsDuarte08@gmail.com>
date Wed, 31 Jul 2019 11:00:20 -0700
parents 10186:520e879a40f2
children 10188:dbd9880bf5c6
files util/prosodyctl.lua
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/prosodyctl.lua	Wed Jul 31 10:22:40 2019 -0700
+++ b/util/prosodyctl.lua	Wed Jul 31 11:00:20 2019 -0700
@@ -322,6 +322,19 @@
 	end
 end
 
+local function execute_command(arg)
+	local operation = arg[#arg]
+	local tree, mod, dir = check_flags(arg);
+	if tree then
+		call_luarocks(operation, mod, dir);
+		return 0;
+	else
+		dir = get_path_custom_plugins(prosody.paths.plugins);
+		call_luarocks(operation, mod, dir);
+		return 0;
+	end
+end
+
 return {
 	show_message = show_message;
 	show_warning = show_message;
@@ -345,4 +358,5 @@
 	get_path_custom_plugins = get_path_custom_plugins;
 	check_flags = check_flags;
 	call_luarocks = call_luarocks;
+	execute_command = execute_command;
 };