]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/scripts/parameters.lua
ADD: a minor xor script
[proxmark3-svn] / client / scripts / parameters.lua
CommitLineData
30a5d355 1
2-- The getopt-functionality is loaded from pm3/getopt.lua
3-- Have a look there for further details
4getopt = require('getopt')
5
6usage = "script run parameters.lua -a 1 -blala -c -de"
7author = "Martin Holst Swende"
8desc =[[
9This is an example script to demonstrate handle parameters in scripts.
10For more info, check the comments in the code
11]]
12
13local function main(args)
14
15 print(desc)
16 print("These parameters were passed")
17 --[[
18 When passing parameters,
19 x: means that a value should follow x
20 y means that 'y' is a flag, either on or off
21 So, the string a:b:def means that we support up to
22 5 parameters; two with values and three flags. The following
23 should be valid:
24
25 script run parameters.lua -a 1 -blala -c -de
26
27 Notice two things:
28 1. 'blala' works just like 'b lala', both set 'b' to 'lala'
29 2. Flags can be put together, '-de' is the same as '-d -e'
30 3. The format -b=lala is *not* supported
31 4. The format b lala (without -) is *not* supported
32 --]]
33
34 for o, a in getopt.getopt(args, 'a:b:ced') do
35 print(o, a)
36 end
37end
38
39
40--[[
41In the future, we may implement so that scripts are invoked directly
42into a 'main' function, instead of being executed blindly. For future
43compatibility, I have done so, but I invoke my main from here.
44--]]
45main(args)
Impressum, Datenschutz