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 |