def getOptions():
try:
options, args = getopt.getopt(sys.argv[1:], "y:j:n:sw", ["yaml=", "jinja=", "notrim", "strict", "warning"])
except getopt.GetoptError as err:
# print help information and exit:
print str(err) # will print something like "option -a not recognized"
sys.exit(2)
global yamlfile,jinjafile,trim,undefined
trim = True
opts = 0
for opt,arg in options:
opts = opts + 1
if opt in ("-y","-yaml"):
yamlfile = arg
elif opt in ("-j","-jinja"):
jinjafile = arg
elif opt in ("-n","-notrim"):
trim = False
elif opt in ("-w","-warning"):
undefined = make_logging_undefined (base = Undefined)
elif opt in ("-s","-strict"):
undefined = make_logging_undefined (base = StrictUndefined)
return opts > 0
评论列表
文章目录