[Skript] run_flaschegeist now allows setting the typescript namespace
This commit is contained in:
parent
d2858c8c76
commit
f238491206
|
@ -28,7 +28,6 @@ def export(arguments):
|
|||
import flaschengeist.system.models as models
|
||||
|
||||
known = []
|
||||
done = []
|
||||
classes = {}
|
||||
|
||||
def pytype(cls):
|
||||
|
@ -69,7 +68,7 @@ def export(arguments):
|
|||
with app.app_context():
|
||||
walker(("models", models))
|
||||
with open(arguments.file, "w") as file:
|
||||
file.write("declare namespace FG {\n")
|
||||
file.write("declare namespace {} \{\n".format(arguments.namespace))
|
||||
for cls, params in classes.items():
|
||||
if isinstance(params, str):
|
||||
file.write("\ttype {} = {};\n".format(cls, params))
|
||||
|
@ -98,6 +97,7 @@ if __name__ == "__main__":
|
|||
parser_export = subparsers.add_parser("export", help="export models to typescript interfaces")
|
||||
parser_export.set_defaults(func=export)
|
||||
parser_export.add_argument("--file", help="Filename where to save", default="flaschengeist.d.ts")
|
||||
parser_export.add_argument("--namespace", help="Namespace of declarations", default="FG")
|
||||
|
||||
args = parser.parse_args()
|
||||
args.func(args)
|
||||
|
|
Loading…
Reference in New Issue