annotate Resources/CodeGeneration/stonegentool.py @ 468:cef55b4e6c21 bgo-commands-codegen

stonegentool first commit
author bgo-osimis
date Mon, 11 Feb 2019 16:01:19 +0100
parents
children 52549faf47ba
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
468
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
1 from __future__ import print_function
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
2 import sys
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
3
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
4
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
5
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
6
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
7
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
8
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
9 if __name__ == '__main__':
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
10 import argparse
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
11 parser = argparse.ArgumentParser(usage = """stonegentool.py [-h] [-o OUT_DIR] [-v] input_schemas
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
12 EXAMPLE: python command_gen.py -o "generated_files/" "mainSchema.json,App Specific Commands.json" """)
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
13 parser.add_argument("input_schemas", type=str,
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
14 help = "one or more schema files, as a comma-separated list of paths")
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
15 parser.add_argument("-o", "--out_dir", type=str, default=".",
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
16 help = """path of the directory where the files
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
17 will be generated. Default is current
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
18 working folder""")
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
19 parser.add_argument("-v", "--verbosity", action="count", default=0,
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
20 help = """increase output verbosity (0 == errors
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
21 only, 1 == some verbosity, 2 == nerd
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
22 mode""")
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
23
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
24 args = parser.parse_args()
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
25 input_schemas = args.input_schemas.split(",")
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
26 out_dir = args.out_dir
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
27
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
28 print("input schemas = " + str(input_schemas))
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
29 print("out dir = " + str(out_dir))
cef55b4e6c21 stonegentool first commit
bgo-osimis
parents:
diff changeset
30