diff options
Diffstat (limited to 'generate.py')
| -rwxr-xr-x | generate.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/generate.py b/generate.py new file mode 100755 index 0000000..26781d3 --- /dev/null +++ b/generate.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + + +import shutil +import subprocess +import sys +import pathlib + + +SCRIPT = pathlib.Path(__file__).resolve() +ROOT = SCRIPT.parent + + +def main() -> None: + maybe_flutter = shutil.which("flutter") + if maybe_flutter is None: + print("Could not find `flutter` executable.") + sys.exit(1) + flutter = pathlib.Path(maybe_flutter).resolve() + + # fmt: off + command = ( + str(flutter), + "create", + "--description", "'Sia app'", + "--org", "eu.xengineering", + "--project-name", "sia_app", + "--platforms", "linux,android", + "--empty", + str(ROOT), + ) + # fmt: on + + print(f"Running '{command_to_str(command)}'") + + subprocess.run(command, shell=False, check=True) + + +def command_to_str(command: tuple[str, ...]) -> str: + retval = "" + + for index, element in enumerate(command): + if index > 0: + retval += " " + + retval += element + + return retval + + +if __name__ == "__main__": + main() |
