From 1cb6bbf8bc9c9638231da326c5eca0cc3a2be426 Mon Sep 17 00:00:00 2001
From: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
Date: Sun, 6 Sep 2020 02:09:47 +0100
Subject: [PATCH] main.lua: add more short aliases

---
 main.lua | 94 ++++++++++++++++++++++++++++++--------------------------
 1 file changed, 51 insertions(+), 43 deletions(-)

diff --git a/main.lua b/main.lua
index abbc811..909f3d2 100644
--- a/main.lua
+++ b/main.lua
@@ -31,45 +31,6 @@ local settings = {
 	path_depth = 1
 }
 
-for i=1,#arg do
-	if not strings.starts_with(arg[i], "-") then
-		table.insert(settings.extras, arg[i])	
-	elseif arg[i] == "--width" or arg[i] == "-w" then
-		i = i + 1
-		settings.width = tonumber(arg[i])
-	elseif arg[i] == "--height" or arg[i] == "-h" then
-		i = i + 1
-		settings.height = tonumber(arg[i])
-	elseif arg[i] == "--depth" or arg[i] == "-d" then
-		i = i + 1
-		settings.depth = tonumber(arg[i])
-	elseif arg[i] == "--seed" or arg[i] == "-s" then
-		i = i + 1
-		settings.seed = tonumber(arg[i])
-	elseif arg[i] == "--filename" or arg[i] == "-f" then
-		i = i + 1
-		settings.filename = arg[i]
-	elseif arg[i] == "--scale" then
-		i = i + 1
-		settings.scale = tonumber(arg[i])
-	elseif arg[i] == "--no-invert" then
-		settings.inverted = false
-	elseif arg[i] == "--path-length" then
-		i = i + 1
-		settings.path_length = tonumber(arg[i])
-	elseif arg[i] == "--path-width" then
-		i = i + 1
-		settings.path_width = tonumber(arg[i])
-	elseif arg[i] == "--path-depth" then
-		i = i + 1
-		settings.path_depth = tonumber(arg[i])
-	end
-end
-
-if #settings.extras > 0 then
-	settings.mode = table.remove(settings.extras, 1)
-end
-
 local function help()
 	print([[
 ]]..a.fgreen(a.hicol("multimaze: "))..a.fyellow(a.hicol("Multidimensional maze generator"))..[[
@@ -91,16 +52,17 @@ local function help()
 
 ]]..a.header("Options:")..[[
 
+		]]..a.item("--help")..[[		Shows this message
 	]]..a.item("-w	--width")..a.value(" {int}")..[[		Sets the width of the maze
 	]]..a.item("-h	--height")..a.value(" {int}")..[[		Sets the height of the maze
 	]]..a.item("-d	--depth")..a.value(" {int}")..[[		Sets the depth of the maze [3d only]
 	]]..a.item("-s	--seed")..a.value(" {string}")..[[		Sets the seed
 	]]..a.item("-f	--filename")..a.value(" {string}")..[[	Sets the output filename
 		]]..a.item("--no-invert")..[[		Don't invert the output [openscad output only]
-		]]..a.item("--scale")..a.value(" {int}")..[[		Sets the scale of the output [openscad output only]
-		]]..a.item("--path-length")..a.value(" {int}")..[[	Sets the path length
-		]]..a.item("--path-width")..a.value(" {int}")..[[	Sets the path width
-		]]..a.item("--path-depth")..a.value(" {int}")..[[	Sets the path depth [3d only]
+	]]..a.item("-m	--scale")..a.value(" {int}")..[[		Sets the scale of the output [openscad output only]
+	]]..a.item("-l	--path-length")..a.value(" {int}")..[[	Sets the path length
+	]]..a.item("-y	--path-width")..a.value(" {int}")..[[	Sets the path width
+	]]..a.item("-z	--path-depth")..a.value(" {int}")..[[	Sets the path depth [3d only]
 		
 ]]..a.header("Environment Variables:")..[[
 
@@ -109,6 +71,52 @@ local function help()
 ]])
 end
 
+for i=1,#arg do
+	if not strings.starts_with(arg[i], "-") then
+		table.insert(settings.extras, arg[i])
+	elseif arg[i] == "--help" then
+		help()
+		os.exit()	
+	elseif arg[i] == "--width" or arg[i] == "-w" then
+		i = i + 1
+		settings.width = tonumber(arg[i])
+	elseif arg[i] == "--height" or arg[i] == "-h" then
+		i = i + 1
+		settings.height = tonumber(arg[i])
+	elseif arg[i] == "--depth" or arg[i] == "-d" then
+		i = i + 1
+		settings.depth = tonumber(arg[i])
+	elseif arg[i] == "--seed" or arg[i] == "-s" then
+		i = i + 1
+		settings.seed = tonumber(arg[i])
+	elseif arg[i] == "--filename" or arg[i] == "-f" then
+		i = i + 1
+		settings.filename = arg[i]
+	elseif arg[i] == "--scale" or arg[i] == "-m" then
+		i = i + 1
+		settings.scale = tonumber(arg[i])
+	elseif arg[i] == "--no-invert" then
+		settings.inverted = false
+	elseif arg[i] == "--path-length" or arg[i] == "-l" then
+		i = i + 1
+		settings.path_length = tonumber(arg[i])
+	elseif arg[i] == "--path-width" or arg[i] == "-y" then
+		i = i + 1
+		settings.path_width = tonumber(arg[i])
+	elseif arg[i] == "--path-depth" or arg[i] == "-z" then
+		i = i + 1
+		settings.path_depth = tonumber(arg[i])
+	end
+end
+
+if #settings.extras > 0 then
+	settings.mode = table.remove(settings.extras, 1)
+end
+
+
+-------------------------------------------------------------------------------
+
+
 local function maze_text()
 	local world, time = maze2d.generate_maze(
 		settings.seed,
