Software /
code /
prosody
Comparison
prosodyctl @ 10165:8fd6fb34d9c5
prosodyctl: Updated the remove command to use the new directory for custom plugins
author | João Duarte <jvsDuarte08@gmail.com> |
---|---|
date | Wed, 24 Jul 2019 10:46:05 -0700 |
parent | 10164:d145eb696475 |
child | 10166:4d1206ac0d41 |
comparison
equal
deleted
inserted
replaced
10164:d145eb696475 | 10165:8fd6fb34d9c5 |
---|---|
117 function commands.remove(arg) | 117 function commands.remove(arg) |
118 if arg[1] == "--help" then | 118 if arg[1] == "--help" then |
119 show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); | 119 show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); |
120 return 1; | 120 return 1; |
121 end | 121 end |
122 -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now | |
123 for path in prosody.paths.plugins:gmatch("[^;]+") do | |
124 installer_plugin_path = path | |
125 break | |
126 end | |
122 local flag = "--tree=" | 127 local flag = "--tree=" |
123 -- I'm considering this optional flag comes first | 128 -- I'm considering this optional flag comes first |
124 if arg[1] and arg[1]:sub(1, #flag) == flag then | 129 if arg[1] and arg[1]:sub(1, #flag) == flag then |
125 local dir = arg[1]:match("=(.+)$") | 130 local dir = arg[1]:match("=(.+)$") |
126 print("Removing module "..arg[2].." at "..dir) | 131 print("Removing module "..arg[2].." at "..dir) |
127 os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) | 132 os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) |
128 return 0; | 133 return 0; |
129 else | 134 else |
130 print("Removing "..arg[1].." from "..prosody.paths.plugins) | 135 print("Removing "..arg[1].." from "..installer_plugin_path) |
131 os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) | 136 os.execute("luarocks --tree='"..installer_plugin_path.."' remove "..arg[1]) |
132 print("Done!") | 137 print("Done!") |
133 return 0; | 138 return 0; |
134 end | 139 end |
135 end | 140 end |
136 | 141 |