Software /
code /
prosody
Diff
prosodyctl @ 10126:ad640c2e072e
prosodyctl: Implemented the 'list' command, which is a bridge to 'luarocks list'
author | João Duarte <jvsDuarte08@gmail.com> |
---|---|
date | Thu, 20 Jun 2019 19:17:47 +0100 |
parent | 10125:58fe5cff5ca2 |
child | 10128:026815f8d832 |
line wrap: on
line diff
--- a/prosodyctl Fri Jun 07 13:09:01 2019 +0100 +++ b/prosodyctl Thu Jun 20 19:17:47 2019 +0100 @@ -85,6 +85,19 @@ local commands = {}; local command = table.remove(arg, 1); +function commands.list(arg) + -- Need to think about the case with many flags + 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("=(.+)$") + -- These extra double brackets allow us to correctly process names with spaces + os.execute("luarocks list --tree=".."'"..dir.."'") + else + os.execute("luarocks list --tree="..prosody.paths.data.."/rocks") + end +end + function commands.enabled_plugins() for module in modulemanager.get_modules_for_host() do show_warning("%s", module)