diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..2752c49 --- /dev/null +++ b/src/main.py @@ -0,0 +1,31 @@ +import flet as ft +import typer +from typing import Dict, Any + +from node_deployer.config import config +from node_deployer import app as _cli_app +from node_deployer_gui import main as gui_main + + +cmd_params: Dict[Any, Any] = config.typer + +app = typer.Typer( + help="A tool for creating ignition images for automated deployment to a swarm", + **{key: value for key, value in cmd_params.items() if key != "no_args_is_help"}, +) + + +@app.command(name="gui", help="The GUI interface for the node deployer", **cmd_params) +@app.callback(invoke_without_command=True) +def gui_app(): + ft.app(target=gui_main) + + +@app.command(name="cli", help="The CLI interface for the node deployer", **cmd_params) +def cli_app(): + config.update_config("cli") + _cli_app() + + +if __name__ == "__main__": + app() diff --git a/src/node_deployer/__init__.py b/src/node_deployer/__init__.py index 0988658..24ba817 100644 --- a/src/node_deployer/__init__.py +++ b/src/node_deployer/__init__.py @@ -5,9 +5,12 @@ from . import ( create_disk, ) +from .node_deployer import app + __all__ = [ "config", "autoignition", "create_img", "create_disk", + "app", ] diff --git a/src/node_deployer_gui/__init__.py b/src/node_deployer_gui/__init__.py index e69de29..a6e7ff3 100644 --- a/src/node_deployer_gui/__init__.py +++ b/src/node_deployer_gui/__init__.py @@ -0,0 +1,3 @@ +from .gui import main + +__all__ = ["main"] \ No newline at end of file