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.
49 lines
1.0 KiB
49 lines
1.0 KiB
# -*- 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:v', ['model=', 'rtype=']) |
|
except getopt.GetoptError: |
|
usage() |
|
sys.exit(2) |
|
verbose = False |
|
model_value = rtype_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 |
|
|
|
print('model: %s | r_type: %s | verbose: %s' % ( |
|
model_value, rtype_value, verbose)) |
|
|
|
if __name__ == '__main__': |
|
main()
|
|
|