# HG changeset patch # User Kim Alvefur # Date 1605363966 -3600 # Node ID 58d485001448c8a1a5d309ee279c5b613be7bc12 # Parent 11d526d74460bd4b812871406df52b7e003fe88c clix: Use tabs for indentation in command line parsing diff -r 11d526d74460 -r 58d485001448 clix.lua --- a/clix.lua Sat Aug 25 00:19:51 2018 +0200 +++ b/clix.lua Sat Nov 14 15:26:06 2020 +0100 @@ -143,22 +143,22 @@ local command, args_handled_up_to; for i, opt in ipairs(arg) do - if opt:match("^%-") and opt ~= "--" then - local name = opt:match("^%-%-?([^%s=]+)()") - name = (short_opts[name] or name):gsub("%-+", "_"); - if name:match("^no_") then - name = name:sub(4, -1); - opts[name] = false; - 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 + if opt:match("^%-") and opt ~= "--" then + local name = opt:match("^%-%-?([^%s=]+)()") + name = (short_opts[name] or name):gsub("%-+", "_"); + if name:match("^no_") then + name = name:sub(4, -1); + opts[name] = false; + 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 end -- Remove all the handled args from the arg array