Changeset

20:80cc61512f10

clix: Allow --debug to be anywhere on the command-line
author Matthew Wild <mwild1@gmail.com>
date Thu, 07 Jan 2010 20:59:15 +0000
parents 19:3a0a156e0a79
children 21:cdeb02d9546d
files clix.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;