Comparison

clix.lua @ 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
parent 17:fa9efbef8a0c
child 21:cdeb02d9546d
comparison
equal deleted inserted replaced
19:3a0a156e0a79 20:80cc61512f10
24 return 0; 24 return 0;
25 end 25 end
26 26
27 local ok, m = pcall(require, "clix."..command); 27 local ok, m = pcall(require, "clix."..command);
28 if not ok then 28 if not ok then
29 print("Error running command '"..command.."' (run with --debug to see full error)"); 29 local is_debug;
30 if arg[2] == "--debug" then 30 for i=1,#arg do
31 if arg[i] == "--debug" then
32 is_debug = true; break;
33 end
34 end
35 print("Error running command '"..command..(is_debug and "" or "' (run with --debug to see full error)"));
36 if is_debug then
31 print(m); 37 print(m);
32 end 38 end
33 return 1; 39 return 1;
34 end 40 end
35 41