clix: Use tabs for indentation in command line parsing

Sat, 14 Nov 2020 15:26:06 +0100

author
Kim Alvefur <zash@zash.se>
date
Sat, 14 Nov 2020 15:26:06 +0100
changeset 131
58d485001448
parent 130
11d526d74460
child 132
3addfb97296c

clix: Use tabs for indentation in command line parsing

clix.lua file | annotate | diff | comparison | revisions
--- 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

mercurial