cli: avoid fingerprint prompt when option provided

This commit is contained in:
thePR0M3TH3AN
2025-07-11 14:19:16 -04:00
parent e5de6c885e
commit afefb5415b
3 changed files with 26 additions and 14 deletions

View File

@@ -44,11 +44,11 @@ app.add_typer(api_app, name="api")
def _get_pm(ctx: typer.Context) -> PasswordManager:
"""Return a PasswordManager optionally selecting a fingerprint."""
pm = PasswordManager()
fp = ctx.obj.get("fingerprint")
if fp:
# `select_fingerprint` will initialize managers
pm.select_fingerprint(fp)
if fp is None:
pm = PasswordManager()
else:
pm = PasswordManager(fingerprint=fp)
return pm