Changeset

10161:ea10561e5566

prosodyctl: Corrected the remove and install commands' order
author João Duarte <jvsDuarte08@gmail.com>
date Wed, 24 Jul 2019 05:01:35 -0700
parents 10160:320ae3831b34
children 10162:7a4c15f75deb
files prosodyctl
diffstat 1 files changed, 23 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/prosodyctl	Wed Jul 24 04:59:46 2019 -0700
+++ b/prosodyctl	Wed Jul 24 05:01:35 2019 -0700
@@ -85,29 +85,6 @@
 local commands = {};
 local command = table.remove(arg, 1);
 
--- Command to remove a rockspec
--- Receives as an argument the name of the plugin to be removed from the plugins folder
-function commands.remove(arg)
-	if arg[1] == "--help" then
-		show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]);
-		return 1;
-	end
-	local flag = "--tree="
-	-- I'm considering the flag is the first, but there can be many flags
-	if arg[1] and arg[1]:sub(1, #flag) == flag then
-		local dir = arg[1]:match("=(.+)$")
-		print("Removing module "..arg[2].." at "..dir)
-		-- These extra double brackets allow us to correctly process names with spaces
-		os.execute("luarocks remove --tree='"..dir.."' "..arg[2])
-		return 0;
-	else
-		print("Removing "..arg[1].." from "..prosody.paths.plugins)
-		os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1])
-		print("Done!")
-		return 0;
-	end
-end
-
 function commands.install(arg)
 	if arg[1] == "--help" then
 		show_usage([[make]], [[Installs a prosody/luarocks plugin]]);
@@ -133,6 +110,29 @@
 	end
 end
 
+-- Command to remove a rockspec
+-- Receives as an argument the name of the plugin to be removed from the plugins folder
+function commands.remove(arg)
+	if arg[1] == "--help" then
+		show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]);
+		return 1;
+	end
+	local flag = "--tree="
+	-- I'm considering the flag is the first, but there can be many flags
+	if arg[1] and arg[1]:sub(1, #flag) == flag then
+		local dir = arg[1]:match("=(.+)$")
+		print("Removing module "..arg[2].." at "..dir)
+		-- These extra double brackets allow us to correctly process names with spaces
+		os.execute("luarocks remove --tree='"..dir.."' "..arg[2])
+		return 0;
+	else
+		print("Removing "..arg[1].." from "..prosody.paths.plugins)
+		os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1])
+		print("Done!")
+		return 0;
+	end
+end
+
 function commands.list(arg)
 	if arg[1] == "--help" then
 		show_usage([[list]], [[Shows installed rocks]]);