aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-04-03 09:26:45 +1000
committerDavid Walter Seikel2014-04-03 09:26:45 +1000
commit9c493894dae12adf083b5b2ec59c8adc97084acc (patch)
treedad35bd696e35130f82bd0c0b7e2d99882d60d44 /ClientHamr/GuiLua
parentParse the command line arguments. (diff)
downloadSledjHamr-9c493894dae12adf083b5b2ec59c8adc97084acc.zip
SledjHamr-9c493894dae12adf083b5b2ec59c8adc97084acc.tar.gz
SledjHamr-9c493894dae12adf083b5b2ec59c8adc97084acc.tar.bz2
SledjHamr-9c493894dae12adf083b5b2ec59c8adc97084acc.tar.xz
More argument parsing.
Diffstat (limited to 'ClientHamr/GuiLua')
-rw-r--r--ClientHamr/GuiLua/skang.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index 1fbe7cc..0f1285a 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -151,7 +151,7 @@ end
151--[[ Parse command line parameters. 151--[[ Parse command line parameters.
152 152
153This is done in two parts. Skang will do an initial scan and tokenise, 153This is done in two parts. Skang will do an initial scan and tokenise,
154then each module gets a chance to pull it's own stuff from the result. 154then each module gets a chance to pull it's own Things from the result.
155 155
156Make the command line parameter getting MUCH more intelligent, try to support the common 156Make the command line parameter getting MUCH more intelligent, try to support the common
157command line interfaces - 157command line interfaces -
@@ -178,6 +178,16 @@ boolean, value beginning with T, t, F, f, etc is true, otherwise value is false,
178next token starts with an introducer, then value is true. 178next token starts with an introducer, then value is true.
179 179
180TODO - Finish supporting all of the above. 180TODO - Finish supporting all of the above.
181 -ab - Perhaps check for single character aliases, and if one matches, replace '-ab' with '-b'.
182 If a match is found, and there's letters left, DON'T mark it as used.
183 If it was the last one that was replaced, then check if there's a value after it.
184 These all need deeper parsing, but we dunno if they might have been inside quoted strings from the shell.
185 arg=value
186 arg = value
187 arg1=value1&arg2=value2
188 arg1=value1|arg2=value2
189 On the other hand,
190 --arg = value -> --arg value
181]] 191]]
182 192
183ARGS = {} 193ARGS = {}
@@ -198,7 +208,7 @@ scanArguments = function (args)
198 if '=' == string.sub(v, 1, 1) then pre = '='; v = string.sub(v, 2, -1) end 208 if '=' == string.sub(v, 1, 1) then pre = '='; v = string.sub(v, 2, -1) end
199 if '&' == string.sub(v, 1, 1) then pre = '&'; v = string.sub(v, 2, -1) end 209 if '&' == string.sub(v, 1, 1) then pre = '&'; v = string.sub(v, 2, -1) end
200 if '|' == string.sub(v, 1, 1) then pre = '|'; v = string.sub(v, 2, -1) end 210 if '|' == string.sub(v, 1, 1) then pre = '|'; v = string.sub(v, 2, -1) end
201 ARGS[i] = {pre, v} 211 if '' ~= v then ARGS[i] = {pre, v} end
202 end 212 end
203 end 213 end
204end 214end