mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-13 08:11:42 +00:00
Add TUI v2 scaffold, plan docs, and discovery command hints
This commit is contained in:
1 parent
982fba6404
commit
8d3d2a3993
10 files changed
+222
-2
No files matched your search
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import importlib.util
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from typing import Optional
|
||||
@@ -11,6 +12,7 @@ import typer
|
||||
from .common import _get_services
|
||||
from seedpass.core.errors import SeedPassError
|
||||
from constants import GUI_BACKEND_CONFIG
|
||||
from seedpass.tui_v2.app import check_tui2_runtime, launch_tui2
|
||||
|
||||
app = typer.Typer(
|
||||
help=(
|
||||
@@ -105,6 +107,45 @@ def root_lock(ctx: typer.Context) -> None:
|
||||
typer.echo("locked")
|
||||
|
||||
|
||||
@app.command("tui2")
|
||||
def tui2(
|
||||
ctx: typer.Context,
|
||||
check: bool = typer.Option(
|
||||
False,
|
||||
"--check",
|
||||
help="Check whether TUI v2 runtime dependencies are available",
|
||||
),
|
||||
fallback_legacy: bool = typer.Option(
|
||||
True,
|
||||
"--fallback-legacy/--no-fallback-legacy",
|
||||
help="Fall back to legacy TUI when TUI v2 runtime is unavailable",
|
||||
),
|
||||
) -> None:
|
||||
"""Launch experimental TUI v2 scaffold."""
|
||||
if check:
|
||||
typer.echo(json.dumps(check_tui2_runtime(), indent=2, sort_keys=True))
|
||||
return
|
||||
|
||||
fingerprint = (ctx.obj or {}).get("fingerprint")
|
||||
launched = launch_tui2(fingerprint=fingerprint)
|
||||
if launched:
|
||||
return
|
||||
|
||||
if fallback_legacy:
|
||||
typer.echo(
|
||||
"TUI v2 runtime unavailable; falling back to legacy TUI. "
|
||||
"Run `seedpass tui2 --check` for diagnostics."
|
||||
)
|
||||
tui = importlib.import_module("main")
|
||||
raise typer.Exit(tui.main(fingerprint=fingerprint))
|
||||
|
||||
typer.echo(
|
||||
"TUI v2 runtime unavailable. Install `textual` and retry.",
|
||||
err=True,
|
||||
)
|
||||
raise typer.Exit(1)
|
||||
|
||||
|
||||
@app.command()
|
||||
def gui(
|
||||
install: bool = typer.Option(
|
||||
|
||||
Reference in new issue
Block a user