mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 15:58:48 +00:00
Make seedpass command launch TUI by default
This commit is contained in:
@@ -9,7 +9,12 @@ from password_manager.entry_types import EntryType
|
|||||||
import uvicorn
|
import uvicorn
|
||||||
from . import api as api_module
|
from . import api as api_module
|
||||||
|
|
||||||
app = typer.Typer(help="SeedPass command line interface")
|
import importlib
|
||||||
|
|
||||||
|
app = typer.Typer(
|
||||||
|
help="SeedPass command line interface",
|
||||||
|
invoke_without_command=True,
|
||||||
|
)
|
||||||
|
|
||||||
# Global option shared across all commands
|
# Global option shared across all commands
|
||||||
fingerprint_option = typer.Option(
|
fingerprint_option = typer.Option(
|
||||||
@@ -47,10 +52,16 @@ def _get_pm(ctx: typer.Context) -> PasswordManager:
|
|||||||
return pm
|
return pm
|
||||||
|
|
||||||
|
|
||||||
@app.callback()
|
@app.callback(invoke_without_command=True)
|
||||||
def main(ctx: typer.Context, fingerprint: Optional[str] = fingerprint_option) -> None:
|
def main(ctx: typer.Context, fingerprint: Optional[str] = fingerprint_option) -> None:
|
||||||
"""SeedPass CLI entry point."""
|
"""SeedPass CLI entry point.
|
||||||
|
|
||||||
|
When called without a subcommand this launches the interactive TUI.
|
||||||
|
"""
|
||||||
ctx.obj = {"fingerprint": fingerprint}
|
ctx.obj = {"fingerprint": fingerprint}
|
||||||
|
if ctx.invoked_subcommand is None:
|
||||||
|
tui = importlib.import_module("main")
|
||||||
|
raise typer.Exit(tui.main())
|
||||||
|
|
||||||
|
|
||||||
@entry_app.command("list")
|
@entry_app.command("list")
|
||||||
|
Reference in New Issue
Block a user