-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmdOPTtest.py
37 lines (32 loc) · 1.03 KB
/
cmdOPTtest.py
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
import getopt
import sys
version = '1.0'
verbose = False
output_filename = 'default.out'
app = 'default'
key = '123456'
print 'ARGV :', sys.argv[1:]
options, remainder = getopt.getopt(sys.argv[1:], 'vka:o:', [
'version=',
'key=',
'app=',
'output='
])
print 'OPTIONS :', options
for opt, arg in options:
if opt in ('-o', '--output'):
output_filename = arg
elif opt in ('-v', '--verbose'):
verbose = True
elif opt == '--version':
version = arg
elif opt in ('-k', '--key'):
key = arg
elif opt in ('-a', '--app'):
app = arg
print 'VERSION :', version
print 'VERBOSE :', verbose
print 'OUTPUT :', output_filename
print 'REMAINING :', remainder
print 'APP :', app
print 'KEY :', key