From 2049e20696aecd37419fafb8b38c96550b04a442 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= <jvsDuarte08@gmail.com>
Date: Wed, 31 Jul 2019 11:00:20 -0700
Subject: util.prosodyctl: Added the execute_command function

---
 util/prosodyctl.lua | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'util')

diff --git a/util/prosodyctl.lua b/util/prosodyctl.lua
index 7fe87dab..274d611c 100644
--- a/util/prosodyctl.lua
+++ b/util/prosodyctl.lua
@@ -322,6 +322,19 @@ local function call_luarocks(operation, mod, dir)
 	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 @@ return {
 	get_path_custom_plugins = get_path_custom_plugins;
 	check_flags = check_flags;
 	call_luarocks = call_luarocks;
+	execute_command = execute_command;
 };
-- 
cgit v1.2.3