prosodyctl about: Use library function for sorted listing of lua modules

Code reuse and one less module to import is nice.
This commit is contained in:
Kim Alvefur 2020-07-10 03:13:27 +02:00
parent b15a51597b
commit 37566b1cc3

View file

@ -378,8 +378,7 @@ function commands.about(arg)
end end
local pwd = "."; local pwd = ".";
local array = require "util.array"; local sorted_pairs = require "util.iterators".sorted_pairs;
local keys = require "util.iterators".keys;
local hg = require"util.mercurial"; local hg = require"util.mercurial";
local relpath = configmanager.resolve_relative_path; local relpath = configmanager.resolve_relative_path;
@ -461,9 +460,8 @@ function commands.about(arg)
end end
module_versions["libunbound"] = lunbound._LIBVER; module_versions["libunbound"] = lunbound._LIBVER;
end end
local sorted_keys = array.collect(keys(module_versions)):sort(); for name, version in sorted_pairs(module_versions) do
for _, name in ipairs(sorted_keys) do print(name..":"..string.rep(" ", longest_name-#name), version);
print(name..":"..string.rep(" ", longest_name-#name), module_versions[name]);
end end
print(""); print("");
end end