You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.3 KiB
59 lines
1.3 KiB
10 years ago
|
# -*- coding: utf-8 -*-
|
||
|
#!/usr/bin/env python
|
||
|
from __future__ import absolute_import, print_function
|
||
|
import sys
|
||
|
import getopt
|
||
|
import time
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
def usage():
|
||
|
print('Help:')
|
||
|
|
||
|
|
||
|
def main():
|
||
|
override = False
|
||
|
try:
|
||
|
opts, args = getopt.getopt(sys.argv[1:], 'm:r:k:v', ['model=', 'rtype=', 'ksearch='])
|
||
|
except getopt.GetoptError:
|
||
|
usage()
|
||
|
sys.exit(2)
|
||
|
verbose = False
|
||
|
model_value = rtype_value = k_value = None
|
||
|
for opt, arg in opts:
|
||
|
if opt == "-v":
|
||
|
verbose = True
|
||
|
elif opt in ('-m', '--model'):
|
||
|
## TODO: filter model availabel and throw exception if invalid
|
||
|
if len(arg) != 4:
|
||
|
usage()
|
||
|
sys.exit(2)
|
||
|
model_value = arg.upper()
|
||
|
elif opt in ('-r', '--rtype'):
|
||
|
if arg not in '1234':
|
||
|
usage()
|
||
|
sys.exit(2)
|
||
|
rtype_value = arg
|
||
|
elif opt in ('-k', '--ksearch'):
|
||
|
if arg.upper() not in 'ABCDEFGHIJKLMNOPQRS':
|
||
|
usage()
|
||
|
sys.exit(2)
|
||
|
k_value = arg.upper()
|
||
|
|
||
|
if not (model_value and rtype_value and k_value):
|
||
|
usage()
|
||
|
sys.exit(2)
|
||
|
|
||
|
print('model: %s | r_type: %s | k_search: %s | verbose: %s' % (
|
||
|
model_value, rtype_value, k_value, verbose))
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|