diff -r 0712fda16ab6 -r bb7a51aca282 clix.lua --- a/clix.lua Mon Jun 07 13:42:46 2010 -0400 +++ b/clix.lua Mon Jun 07 20:19:53 2010 +0100 @@ -106,12 +106,11 @@ return err or 0; end -table.remove(arg,1); - local opts = {}; -local args_handled_up_to; +local command, args_handled_up_to; for i, opt in ipairs(arg) do + print(i, opt) if opt:match("^%-") and opt ~= "--" then local name = opt:match("^%-%-?([^%s=]+)()") name = (short_opts[name] or name):gsub("%-+", "_"); @@ -121,10 +120,13 @@ else opts[name] = opt:match("=(.*)$") or true; end + elseif not command then + command = arg[i]; + args_handled_up_to = i-1; else - args_handled_up_to = i-1; - break; - end + args_handled_up_to = i-1; + break; + end end -- Remove all the handled args from the arg array @@ -132,8 +134,6 @@ table.remove(arg, n); end -local command = arg[1]; - local ok, m = pcall(require, "clix."..command); if not ok then local is_debug;