aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-06-27 12:02:50 +0100
committerMatthew Wild <mwild1@gmail.com>2011-06-27 12:02:50 +0100
commit47179a8bb89136d6ff2e196bc443eb50b3c0fb92 (patch)
treec5e08c811063cf691f93df65ba9c7618e061fec4 /prosodyctl
parentba19cdbf9a43e87deef9db91f6bc3b27d9143870 (diff)
downloadprosody-47179a8bb89136d6ff2e196bc443eb50b3c0fb92.tar.gz
prosody-47179a8bb89136d6ff2e196bc443eb50b3c0fb92.zip
prosodyctl: Add 'about' command to list Prosody version, directories, and various other stuff
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl45
1 files changed, 44 insertions, 1 deletions
diff --git a/prosodyctl b/prosodyctl
index 8fdf3488..c468eb7d 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -485,6 +485,49 @@ function commands.restart(arg)
return commands.start(arg);
end
+function commands.about(arg)
+ require "util.array";
+ require "util.iterators";
+
+ print("Prosody "..(prosody.version or "(unknown version)"));
+ print("");
+ print("# Prosody directories");
+ print("Data directory: ", CFG_DATADIR or "./");
+ print("Plugin directory:", CFG_PLUGINDIR or "./");
+ print("Config directory:", CFG_CONFIGDIR or "./");
+ print("Source directory:", CFG_SOURCEDIR or "./");
+ print("");
+ print("# Lua environment");
+ print("Lua version: ", _G._VERSION);
+ print("");
+ print("Lua module search paths:");
+ for path in package.path:gmatch("[^;]+") do
+ print(" "..path);
+ end
+ print("");
+ print("Lua C module search paths:");
+ for path in package.cpath:gmatch("[^;]+") do
+ print(" "..path);
+ end
+ print("");
+ print("# Lua module versions");
+ local module_versions, longest_name = {}, 8;
+ for name, module in pairs(package.loaded) do
+ if type(module) == "table" and rawget(module, "_VERSION")
+ and name ~= "_G" and not name:match("%.") then
+ if #name > longest_name then
+ longest_name = #name;
+ end
+ module_versions[name] = module._VERSION;
+ end
+ end
+ local sorted_keys = array.collect(keys(module_versions)):sort();
+ for _, name in ipairs(array.collect(keys(module_versions)):sort()) do
+ print(name..":"..string.rep(" ", longest_name-#name), module_versions[name]);
+ end
+ print("");
+end
+
-- ejabberdctl compatibility
function commands.register(arg)
@@ -588,7 +631,7 @@ if not commands[command] then -- Show help for all commands
print("Where COMMAND may be one of:\n");
local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" };
- local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart" };
+ local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart", "about" };
local done = {};