Software /
code /
clix
Changeset
131:58d485001448
clix: Use tabs for indentation in command line parsing
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 14 Nov 2020 15:26:06 +0100 (2020-11-14) |
parents | 130:11d526d74460 |
children | 132:3addfb97296c |
files | clix.lua |
diffstat | 1 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- 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