Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
717d2bc7d8
|
|||
f33d4f4d25
|
@ -5,9 +5,14 @@ import argparse
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser(description="generate.py")
|
parser = argparse.ArgumentParser(description="generate.py")
|
||||||
parser.add_argument('--schema', '-s',
|
parser.add_argument('--schema', '-s',
|
||||||
help='Schema file',
|
help='Schema file. Default: schema.json in the current folder.',
|
||||||
required=False,
|
required=False,
|
||||||
default='./schema.json')
|
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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +40,7 @@ for table in schema["tables"]:
|
|||||||
column["apitype"] = 'number'
|
column["apitype"] = 'number'
|
||||||
column["jstype"] = 'number'
|
column["jstype"] = 'number'
|
||||||
|
|
||||||
for f in glob.glob("*.tmpl"):
|
for f in glob.glob(args.template):
|
||||||
print(f"process {f}")
|
print(f"process {f}")
|
||||||
tmpl = Template(file=f, searchList=[schema])
|
tmpl = Template(file=f, searchList=[schema])
|
||||||
with open(f[:-5], 'w') as outFile:
|
with open(f[:-5], 'w') as outFile:
|
||||||
|
3
generateHelper.py
Normal file
3
generateHelper.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
def JsNameConverter(tmplName):
|
||||||
|
return ''.join([x.capitalize() for x in tmplName.split('_')])
|
||||||
|
|
Reference in New Issue
Block a user