Software / code / prosody
Comparison
prosodyctl @ 10142:1e192e8d4e9d
prosodyctl: Improved the 'list' command
| author | João Duarte <jvsDuarte08@gmail.com> |
|---|---|
| date | Wed, 17 Jul 2019 03:31:02 -0700 |
| parent | 10141:cf70deac27f6 |
| child | 10143:a099bff1842d |
comparison
equal
deleted
inserted
replaced
| 10141:cf70deac27f6 | 10142:1e192e8d4e9d |
|---|---|
| 162 os.execute("luarocks --tree='./plugins' install "..arg[1]) | 162 os.execute("luarocks --tree='./plugins' install "..arg[1]) |
| 163 return 0 | 163 return 0 |
| 164 end | 164 end |
| 165 | 165 |
| 166 function commands.list(arg) | 166 function commands.list(arg) |
| 167 if not arg[1] or arg[1] == "--help" then | 167 if arg[1] == "--help" then |
| 168 show_usage([[list]], [[Shows installed rocks]]); | 168 show_usage([[list]], [[Shows installed rocks]]); |
| 169 return 1; | 169 return 1; |
| 170 end | 170 end |
| 171 -- Need to think about the case with many flags | 171 -- Need to think about the case with many flags |
| 172 local flag = "--tree=" | 172 local flag = "--tree=" |
| 173 -- I'm considering the flag is the first, but there can be many flags | 173 -- I'm considering the flag is the first, but there can be many flags |
| 174 if arg[1] and arg[1]:sub(1, #flag) == flag then | 174 if arg[1] and arg[1]:sub(1, #flag) == flag then |
| 175 local dir = arg[1]:match("=(.+)$") | 175 local dir = arg[1]:match("=(.+)$") |
| 176 -- These extra double brackets allow us to correctly process names with spaces | 176 -- These extra double brackets allow us to correctly process names with spaces |
| 177 os.execute("luarocks list --tree=".."'"..dir.."'") | 177 os.execute("luarocks list --tree='"..dir.."'") |
| 178 return 0; | 178 return 0; |
| 179 else | 179 else |
| 180 os.execute("luarocks list --tree="..prosody.paths.data.."/rocks") | 180 os.execute("luarocks list --tree="..prosody.paths.plugins) |
| 181 return 0; | 181 return 0; |
| 182 end | 182 end |
| 183 end | 183 end |
| 184 | 184 |
| 185 function commands.admin_add(arg) | 185 function commands.admin_add(arg) |