clix.lua

changeset 20
80cc61512f10
parent 17
fa9efbef8a0c
child 21
cdeb02d9546d
--- a/clix.lua	Thu Jan 07 20:58:52 2010 +0000
+++ b/clix.lua	Thu Jan 07 20:59:15 2010 +0000
@@ -26,8 +26,14 @@
 
 local ok, m = pcall(require, "clix."..command);
 if not ok then
-	print("Error running command '"..command.."' (run with --debug to see full error)");
-	if arg[2] == "--debug" then
+	local is_debug;
+	for i=1,#arg do
+		if arg[i] == "--debug" then
+			is_debug = true; break;
+		end
+	end
+	print("Error running command '"..command..(is_debug and "" or "' (run with --debug to see full error)"));
+	if is_debug then
 		print(m);
 	end
 	return 1;

mercurial