changeset 1766:e4c3d335b07f

mod_list_inactive: Print some usage info when not called with enough arguments
author Kim Alvefur <zash@zash.se>
date Mon, 08 Jun 2015 15:27:28 +0200
parents 1a7867eaac9e
children ca48eea4785c
files mod_list_inactive/mod_list_inactive.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_list_inactive/mod_list_inactive.lua	Fri May 29 14:35:01 2015 +0200
+++ b/mod_list_inactive/mod_list_inactive.lua	Mon Jun 08 15:27:28 2015 +0200
@@ -19,6 +19,15 @@
 }
 
 function module.command(arg)
+	if #arg < 2 then
+		print("usage: prosodyctl mod_list_inactive example.net time [format]");
+		print("time is a number followed by 'day', 'week', 'month' or 'year'");
+		print("formats are:");
+		for name, fmt in pairs(output_formats) do
+			print(name, fmt:format("user@example.com", "last action"))
+		end
+		return;
+	end
 	local items = {};
 	local host = arg[1];
 	assert(hosts[host], "Host "..tostring(host).." does not exist");