]> cvs.zerfleddert.de Git - proxmark3-svn/blob - client/scripts/parameters.lua
added changelog
[proxmark3-svn] / client / scripts / parameters.lua
1
2 -- The getopt-functionality is loaded from pm3/getopt.lua
3 -- Have a look there for further details
4 getopt = require('getopt')
5
6 usage = "script run parameters.lua -a 1 -blala -c -de"
7 author = "Martin Holst Swende"
8 desc =[[
9 This is an example script to demonstrate handle parameters in scripts.
10 For more info, check the comments in the code
11 ]]
12
13 local 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
37 end
38
39
40 --[[
41 In the future, we may implement so that scripts are invoked directly
42 into a 'main' function, instead of being executed blindly. For future
43 compatibility, I have done so, but I invoke my main from here.
44 --]]
45 main(args)
Impressum, Datenschutz