Software / code / prosody
Comparison
prosodyctl @ 11002:b0766f2603e9
prosodyctl about: Use library function for sorted listing of lua modules
Code reuse and one less module to import is nice.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 10 Jul 2020 03:13:27 +0200 |
| parent | 10964:d6a3d652ca32 |
| child | 11003:c82ede8892fc |
comparison
equal
deleted
inserted
replaced
| 11001:09b74aba015d | 11002:b0766f2603e9 |
|---|---|
| 376 show_usage([[about]], [[Show information about this Prosody installation]]); | 376 show_usage([[about]], [[Show information about this Prosody installation]]); |
| 377 return 1; | 377 return 1; |
| 378 end | 378 end |
| 379 | 379 |
| 380 local pwd = "."; | 380 local pwd = "."; |
| 381 local array = require "util.array"; | 381 local sorted_pairs = require "util.iterators".sorted_pairs; |
| 382 local keys = require "util.iterators".keys; | |
| 383 local hg = require"util.mercurial"; | 382 local hg = require"util.mercurial"; |
| 384 local relpath = configmanager.resolve_relative_path; | 383 local relpath = configmanager.resolve_relative_path; |
| 385 | 384 |
| 386 print("Prosody "..(prosody.version or "(unknown version)")); | 385 print("Prosody "..(prosody.version or "(unknown version)")); |
| 387 print(""); | 386 print(""); |
| 459 if not module_versions["lunbound"] then | 458 if not module_versions["lunbound"] then |
| 460 module_versions["lunbound"] = "<= 0.5"; | 459 module_versions["lunbound"] = "<= 0.5"; |
| 461 end | 460 end |
| 462 module_versions["libunbound"] = lunbound._LIBVER; | 461 module_versions["libunbound"] = lunbound._LIBVER; |
| 463 end | 462 end |
| 464 local sorted_keys = array.collect(keys(module_versions)):sort(); | 463 for name, version in sorted_pairs(module_versions) do |
| 465 for _, name in ipairs(sorted_keys) do | 464 print(name..":"..string.rep(" ", longest_name-#name), version); |
| 466 print(name..":"..string.rep(" ", longest_name-#name), module_versions[name]); | |
| 467 end | 465 end |
| 468 print(""); | 466 print(""); |
| 469 end | 467 end |
| 470 | 468 |
| 471 function commands.reload(arg) | 469 function commands.reload(arg) |