Software /
code /
prosody
Diff
prosodyctl @ 10184:5655cd9fc8e9
prosodyctl: Rewrote the remove command, to make it cleaner and easier to work with
author | João Duarte <jvsDuarte08@gmail.com> |
---|---|
date | Wed, 31 Jul 2019 10:07:22 -0700 |
parent | 10182:bb7d537e6fba |
child | 10186:520e879a40f2 |
line wrap: on
line diff
--- a/prosodyctl Wed Jul 31 10:02:42 2019 -0700 +++ b/prosodyctl Wed Jul 31 10:07:22 2019 -0700 @@ -109,17 +109,14 @@ show_usage([[remove]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1; end - local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) - local flag = "--tree=" - -- I'm considering this optional flag comes first - if arg[1] and arg[1]:sub(1, #flag) == flag then - local dir = arg[1]:match("=(.+)$") - show_message("Removing module %s at %s", arg[2], dir) - os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) + local operation = "remove"; + local tree, mod, dir = check_flags(arg); + if tree then + call_luarocks(operation, mod, dir); return 0; else - show_message("Removing %s from %s", arg[1], installer_plugin_path) - os.execute("luarocks --tree='"..installer_plugin_path.."' remove "..arg[1]) + dir = get_path_custom_plugins(prosody.paths.plugins); + call_luarocks(operation, mod, dir); return 0; end end