From 8654b25e802c0fa0cd4b8dbc1957100be93b7e6a Mon Sep 17 00:00:00 2001 From: andreas-ementio <109289207+andreas-ementio@users.noreply.github.com> Date: Thu, 14 Jul 2022 17:19:31 +0200 Subject: [PATCH] Fix CLI output when using clip with the -t flag if you use the CLI with -t/--totp flag, the program prints out: "Entry's "password" attribute copied to the clipboard!" expected output is "Entry's "totp" attribute copied to the clipboard!" the same when you run with -a totp --- src/cli/Clip.cpp | 1 + tests/TestCli.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/cli/Clip.cpp b/src/cli/Clip.cpp index 64e56638e..47964b190 100644 --- a/src/cli/Clip.cpp +++ b/src/cli/Clip.cpp @@ -116,6 +116,7 @@ int Clip::executeWithDatabase(QSharedPointer database, QSharedPointer< return EXIT_FAILURE; } + selectedAttribute = "totp"; found = true; value = entry->totp(); } else if (Utils::EntryFieldNames.contains(selectedAttribute)) { diff --git a/tests/TestCli.cpp b/tests/TestCli.cpp index 14012cdcd..f822dfe34 100644 --- a/tests/TestCli.cpp +++ b/tests/TestCli.cpp @@ -671,6 +671,7 @@ void TestCli::testClip() setInput("a"); execCmd(clipCmd, {"clip", m_dbFile->fileName(), "/Sample Entry", "0", "--totp"}); QTRY_VERIFY(isTotp(clipboard->text())); + QCOMPARE(m_stdout->readLine(), QByteArray("Entry's \"totp\" attribute copied to the clipboard!\n")); // Test Unicode setInput("a");