From 083a93440b8bf21f48b4b1af1dfcd7c68c74df44 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 3 Jul 2025 16:16:05 -0400 Subject: [PATCH] Add clipboard copy message for totp CLI --- requirements.lock | 1 + src/main.py | 1 + src/tests/test_cli_subcommands.py | 1 + 3 files changed, 3 insertions(+) diff --git a/requirements.lock b/requirements.lock index c84c4b0..8463281 100644 --- a/requirements.lock +++ b/requirements.lock @@ -42,6 +42,7 @@ pycoin==0.92.20241201 pycparser==2.22 pycryptodome==3.23.0 pycryptodomex==3.23.0 +pyperclip==1.9.0 Pygments==2.19.2 PyNaCl==1.5.0 PySocks==1.7.1 diff --git a/src/main.py b/src/main.py index 601400a..5c1b795 100644 --- a/src/main.py +++ b/src/main.py @@ -809,6 +809,7 @@ def main(argv: list[str] | None = None) -> int: print(code) try: pyperclip.copy(code) + print(colored("Code copied to clipboard", "green")) except Exception as exc: logging.warning(f"Clipboard copy failed: {exc}") return 0 diff --git a/src/tests/test_cli_subcommands.py b/src/tests/test_cli_subcommands.py index e6d6ae7..e48c18e 100644 --- a/src/tests/test_cli_subcommands.py +++ b/src/tests/test_cli_subcommands.py @@ -63,4 +63,5 @@ def test_totp_command(monkeypatch, capsys): assert rc == 0 out = capsys.readouterr().out assert "123456" in out + assert "copied to clipboard" in out.lower() assert called.get("val") == "123456"