drop generate.sh, generate.py can do it alone using recursive glob
This commit is contained in:
@ -10,9 +10,9 @@ parser.add_argument('--schema', '-s',
|
|||||||
default='./schema.json')
|
default='./schema.json')
|
||||||
parser.add_argument('--template', '-t',
|
parser.add_argument('--template', '-t',
|
||||||
help="""Template file, templates files must be named as the final output file
|
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.""",
|
with an additional .tmpl extension. Default: all template files recursively from the current folder.""",
|
||||||
required=False,
|
required=False,
|
||||||
default="*.tmpl")
|
default="**/*.tmpl")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ schema["GENERATED_PYTHON_COMMENT"] = """
|
|||||||
# DO NOT EDIT MANUALLY
|
# DO NOT EDIT MANUALLY
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for f in glob.glob(args.template):
|
for f in glob.glob(args.template, recursive=True):
|
||||||
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:
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
find . -name \*.tmpl -exec python generate.py --schema schema.json --template {} \;
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user