Software /
code /
prosody
Comparison
prosodyctl @ 10186:520e879a40f2
prosodyctl: Rewrote the list command, to make it cleaner and easier to work with
author | João Duarte <jvsDuarte08@gmail.com> |
---|---|
date | Wed, 31 Jul 2019 10:22:40 -0700 |
parent | 10184:5655cd9fc8e9 |
child | 10188:dbd9880bf5c6 |
comparison
equal
deleted
inserted
replaced
10185:02d8f475a96d | 10186:520e879a40f2 |
---|---|
124 function commands.list(arg) | 124 function commands.list(arg) |
125 if arg[1] == "--help" then | 125 if arg[1] == "--help" then |
126 show_usage([[list]], [[Shows installed rocks]]); | 126 show_usage([[list]], [[Shows installed rocks]]); |
127 return 1; | 127 return 1; |
128 end | 128 end |
129 -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now | 129 local operation = "list"; |
130 local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) | 130 local tree, mod, dir = check_flags(arg); |
131 local flag = "--tree=" | 131 if tree then |
132 -- I'm considering this optional flag comes first | 132 call_luarocks(operation, mod, dir); |
133 if arg[1] and arg[1]:sub(1, #flag) == flag then | |
134 local dir = arg[1]:match("=(.+)$") | |
135 os.execute("luarocks list --tree='"..dir.."'") | |
136 return 0; | 133 return 0; |
137 else | 134 else |
138 os.execute("luarocks list --tree="..installer_plugin_path) | 135 dir = get_path_custom_plugins(prosody.paths.plugins); |
136 call_luarocks(operation, mod, dir); | |
139 return 0; | 137 return 0; |
140 end | 138 end |
141 end | 139 end |
142 | 140 |
143 function commands.enabled_plugins(arg) | 141 function commands.enabled_plugins(arg) |