improve generate script
This commit is contained in:
parent
e9aeeb12cc
commit
f33d4f4d25
@ -5,9 +5,14 @@ import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description="generate.py")
|
||||
parser.add_argument('--schema', '-s',
|
||||
help='Schema file',
|
||||
help='Schema file. Default: schema.json in the current folder.',
|
||||
required=False,
|
||||
default='./schema.json')
|
||||
parser.add_argument('--template', '-t',
|
||||
help="""Template file, templates files must be named as the final output file
|
||||
with an additional .tmpl extension. Default: all template files in the current folder.""",
|
||||
required=False,
|
||||
default="*.tmpl")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
@ -35,7 +40,7 @@ for table in schema["tables"]:
|
||||
column["apitype"] = 'number'
|
||||
column["jstype"] = 'number'
|
||||
|
||||
for f in glob.glob("*.tmpl"):
|
||||
for f in glob.glob(args.template):
|
||||
print(f"process {f}")
|
||||
tmpl = Template(file=f, searchList=[schema])
|
||||
with open(f[:-5], 'w') as outFile:
|
||||
|
Loading…
x
Reference in New Issue
Block a user