File: CmdLineOptions.lua

package info (click to toggle)
lmod 8.7.60-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 63,008 kB
  • sloc: sh: 6,266; makefile: 2,837; ansic: 1,513; tcl: 1,382; python: 1,050; csh: 112
file content (45 lines) | stat: -rw-r--r-- 1,053 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
-- $Id: CmdLineOptions.lua 302 2009-02-04 23:56:32Z mclay $ --
CmdLineOptions = BaseTask:new()

function CmdLineOptions:execute(myTable)
   local masterTbl     = masterTbl()
   local usage         = "testfinish [options]"
   local Optiks        = require("Optiks")
   local cmdlineParser = Optiks:new{usage=usage, error = Error}

   cmdlineParser:add_option{ 
      name   = {'-c'},
      dest   = 'cmdResultFn',
      action = 'store',
      type   = 'string',
   }

   cmdlineParser:add_option{ 
      name   = {'-r','--resultFn'},
      dest   = 'resultFn',
      action = 'store',
      type   = 'string',
   }

   cmdlineParser:add_option{ 
      name   = {'-t','--runtimeFn'},
      dest   = 'runtimeFn',
      action = 'store',
      type   = 'string',
   }

   cmdlineParser:add_option{ 
      name   = {'-v','--verbose'},
      dest   = 'verbosityLevel',
      action = 'count'
   }

   local optionTbl, pargs = cmdlineParser:parse(arg)

   for v in pairs(optionTbl) do
      masterTbl[v] = optionTbl[v]
   end

   masterTbl.pargs = pargs

end