Changeset

1103:59657e03c25c

mod_lastlog: Make the command show a help message instead of a traceback when no user given
author Kim Alvefur <zash@zash.se>
date Tue, 09 Jul 2013 09:38:10 +0200
parents 1102:bfde5e5318d7
children 1104:34c86e4d6c9d
files mod_lastlog/mod_lastlog.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_lastlog/mod_lastlog.lua	Mon Jul 08 12:26:19 2013 +0200
+++ b/mod_lastlog/mod_lastlog.lua	Tue Jul 09 09:38:10 2013 +0200
@@ -48,6 +48,10 @@
 end
 
 function module.command(arg)
+	if not arg[1] or arg[1] == "--help" then
+		require"util.prosodyctl".show_usage([[mod_lastlog <user@host>]], [[Show when user last logged in or out]]);
+		return 1;
+	end
 	local user, host = jid.prepped_split(table.remove(arg, 1));
 	require"core.storagemanager".initialize_host(host);
 	local lastlog = assert(datamanager.load(user, host, "lastlog"));