2 Commits

Author SHA1 Message Date
717d2bc7d8 add helper 2021-07-28 18:00:50 +02:00
f33d4f4d25 improve generate script 2021-07-28 17:23:35 +02:00
2 changed files with 10 additions and 2 deletions

View File

@ -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:

3
generateHelper.py Normal file
View File

@ -0,0 +1,3 @@
def JsNameConverter(tmplName):
return ''.join([x.capitalize() for x in tmplName.split('_')])