Add --username option to Clip command. (#3947)
* make Clip accept an attribute name This allows users to copy arbitrary attributes (e.g. username, notes, URL) to the clipboard in addition to the password and TOTP values. * update Clip manpage * Add findAttributes to CLI utils * Use case-insensitive search in Show command. * Use case-insensitive search in Clip command. Co-authored-by: louib <L0U13@protonmail.com>
This commit is contained in:
@@ -331,4 +331,21 @@ namespace Utils
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList findAttributes(const EntryAttributes& attributes, const QString& name)
|
||||
{
|
||||
QStringList result;
|
||||
if (attributes.hasKey(name)) {
|
||||
result.append(name);
|
||||
return result;
|
||||
}
|
||||
|
||||
for (const QString& key : attributes.keys()) {
|
||||
if (key.compare(name, Qt::CaseSensitivity::CaseInsensitive) == 0) {
|
||||
result.append(key);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
Reference in New Issue
Block a user