-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.cfg
67 lines (55 loc) · 1.42 KB
/
example.cfg
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
[PythonTool]
name = tool
header =
#!/usr/bin/env python
import sys
import getopt
import logging
__version__ = '1.1'
__author__ = "Israel Fruchter ([email protected])"
__date__ = '2009-Jun-15'
__copyright__ = "(C) 2009 Israel Fruchter. GNU GPL 2."
__doc__ = '''
%(name)s.py
Version: ''' + __version__ + '''
Author: ''' + __author__ + '''
Date: ''' + __date__ + '''
USAGE:
%(name)s [-v] [-t number] [-i filename]
-i / --input : the file hold packet (in HEX)
-t / --test : running a unit test by number (currently 1-3)
-v : Verbose (run with debug prints)
CHANGE LOG:
Version 1.0:
first working version
TODO-LIST:
* thing needs to be done
'''
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "ho:t:i:v", ["help", "output=", "test=", "input="])
except getopt.GetoptError, err:
#print help information and exit:
print str(err) # will print something like "option -a not recognized"
usage()
sys.exit(2)
output = None
verbose = False
verbose_level = None
testing = 0 # unit testing off
input_filename = None
for opt, param in opts:
if opt == "-v":
verbose = True
elif opt in ("-h", "--help"):
usage()
sys.exit()
elif opt in ("-o", "--output"):
output = param
elif opt in ("-i", "--input"):
input_filename = param
elif opt in ("-t", "--test"):
testing = param
else:
assert False, "unhandled option"
footer =