mirror of
https://github.com/Cian-H/I-Form_Server_Node_Deployer.git
synced 2025-12-22 22:22:02 +00:00
Added app interface that combines CLI and GUI
This commit is contained in:
31
src/main.py
Normal file
31
src/main.py
Normal file
@@ -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()
|
||||
@@ -5,9 +5,12 @@ from . import (
|
||||
create_disk,
|
||||
)
|
||||
|
||||
from .node_deployer import app
|
||||
|
||||
__all__ = [
|
||||
"config",
|
||||
"autoignition",
|
||||
"create_img",
|
||||
"create_disk",
|
||||
"app",
|
||||
]
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
from .gui import main
|
||||
|
||||
__all__ = ["main"]
|
||||
Reference in New Issue
Block a user