mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-05 04:12:03 +00:00
cli: restore legacy launch compatibility and fix tui v2 header rendering
This commit is contained in:
1 parent
a4de52ae4a
commit
8e3aaa8653
3 files changed
+52
-7
No files matched your search
+10
-1
@@ -1652,6 +1652,11 @@ def main(argv: list[str] | None = None, *, fingerprint: str | None = None) -> in
|
||||
action="store_true",
|
||||
help="Derive TOTP secrets deterministically",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--legacy-tui",
|
||||
action="store_true",
|
||||
help="Compatibility flag: launch legacy interactive TUI",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--max-prompt-attempts",
|
||||
type=int,
|
||||
@@ -1679,6 +1684,10 @@ def main(argv: list[str] | None = None, *, fingerprint: str | None = None) -> in
|
||||
|
||||
totp_p = sub.add_parser("totp")
|
||||
totp_p.add_argument("query")
|
||||
sub.add_parser(
|
||||
"legacy",
|
||||
help="Compatibility command: launch legacy interactive TUI",
|
||||
)
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
@@ -1699,7 +1708,7 @@ def main(argv: list[str] | None = None, *, fingerprint: str | None = None) -> in
|
||||
logger.error(f"Failed to restore backup: {e}", exc_info=True)
|
||||
print(colored(f"Error: Failed to restore backup: {e}", "red"))
|
||||
return 1
|
||||
elif args.command is None:
|
||||
elif args.command is None and not args.legacy_tui:
|
||||
print("Startup Options:")
|
||||
print("1. Continue")
|
||||
print("2. Restore from backup")
|
||||
|
||||
@@ -138,7 +138,7 @@ def launch_tui2(
|
||||
border: solid #2abf75;
|
||||
margin: 0 1 0 1;
|
||||
padding: 0 1;
|
||||
height: 1;
|
||||
height: 3;
|
||||
}
|
||||
Input {
|
||||
background: #0d1114;
|
||||
@@ -172,7 +172,7 @@ def launch_tui2(
|
||||
color: #daf2e5;
|
||||
}
|
||||
#top-ribbon {
|
||||
height: 1;
|
||||
height: 3;
|
||||
padding: 0 1;
|
||||
margin: 0 1;
|
||||
border: heavy #2abf75;
|
||||
@@ -183,7 +183,7 @@ def launch_tui2(
|
||||
#body { height: 1fr; margin: 0 1; }
|
||||
#top-work { height: 6fr; }
|
||||
#status {
|
||||
height: 2;
|
||||
height: 4;
|
||||
padding: 0 1;
|
||||
border: heavy #58f29d;
|
||||
background: #11191f;
|
||||
@@ -191,7 +191,7 @@ def launch_tui2(
|
||||
margin: 1 1 0 1;
|
||||
}
|
||||
#action-strip {
|
||||
height: 2;
|
||||
height: 4;
|
||||
padding: 0 1;
|
||||
margin: 0 1;
|
||||
border: heavy #2abf75;
|
||||
@@ -202,7 +202,7 @@ def launch_tui2(
|
||||
#center { width: 1fr; border: solid #1a3024; padding: 0 1; background: #0d1114; margin-left: 1; }
|
||||
#right { height: 5fr; border: heavy #3ce79c; padding: 1; background: #0d1114; margin-top: 0; }
|
||||
#grid-heading {
|
||||
height: 2;
|
||||
height: 4;
|
||||
margin-bottom: 0;
|
||||
border: solid #274533;
|
||||
background: #0b0f13;
|
||||
@@ -212,7 +212,7 @@ def launch_tui2(
|
||||
overflow: hidden;
|
||||
}
|
||||
#inspector-heading {
|
||||
height: 1;
|
||||
height: 3;
|
||||
margin-bottom: 0;
|
||||
border: solid #274533;
|
||||
background: #0b0f13;
|
||||
|
||||
@@ -156,3 +156,39 @@ def test_main_fingerprint_option(monkeypatch):
|
||||
rc = main.main(["--fingerprint", "abc", "search", "q"])
|
||||
assert rc == 0
|
||||
assert called.get("fp") == "abc"
|
||||
|
||||
|
||||
def test_legacy_command_compatibility(monkeypatch):
|
||||
called = {"menu": False}
|
||||
|
||||
monkeypatch.setattr(main, "PasswordManager", lambda *a, **k: make_pm([]))
|
||||
monkeypatch.setattr(main, "configure_logging", lambda: None)
|
||||
monkeypatch.setattr(main, "initialize_app", lambda: None)
|
||||
monkeypatch.setattr(main.signal, "signal", lambda *a, **k: None)
|
||||
monkeypatch.setattr(
|
||||
main,
|
||||
"display_menu",
|
||||
lambda *a, **k: called.__setitem__("menu", True),
|
||||
)
|
||||
|
||||
rc = main.main(["legacy"])
|
||||
assert rc == 0
|
||||
assert called["menu"] is True
|
||||
|
||||
|
||||
def test_legacy_flag_compatibility(monkeypatch):
|
||||
called = {"menu": False}
|
||||
|
||||
monkeypatch.setattr(main, "PasswordManager", lambda *a, **k: make_pm([]))
|
||||
monkeypatch.setattr(main, "configure_logging", lambda: None)
|
||||
monkeypatch.setattr(main, "initialize_app", lambda: None)
|
||||
monkeypatch.setattr(main.signal, "signal", lambda *a, **k: None)
|
||||
monkeypatch.setattr(
|
||||
main,
|
||||
"display_menu",
|
||||
lambda *a, **k: called.__setitem__("menu", True),
|
||||
)
|
||||
|
||||
rc = main.main(["--legacy-tui"])
|
||||
assert rc == 0
|
||||
assert called["menu"] is True
|
||||
Reference in new issue
Block a user