mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-01-03 01:25:48 -05:00
Adding top-level fields to CLI commands
The top-level fields are currently not accessible from the CLI, which makes it impossible to select entries or groups based on the UUID. There are other top-level fields I believe, like the expiry date, but I only added the two most critical fields for the moment.
This commit is contained in:
parent
a6d3f973fa
commit
aa839e2619
6 changed files with 57 additions and 4 deletions
|
|
@ -81,11 +81,22 @@ int Show::executeWithDatabase(QSharedPointer<Database> database, QSharedPointer<
|
|||
bool showDefaultAttributes = attributes.isEmpty() && !showTotp;
|
||||
if (showDefaultAttributes) {
|
||||
attributes = EntryAttributes::DefaultAttributes;
|
||||
for (QString fieldName : Utils::EntryFieldNames) {
|
||||
attributes.append(fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate over the attributes and output them line-by-line.
|
||||
bool encounteredError = false;
|
||||
for (const QString& attributeName : asConst(attributes)) {
|
||||
if (Utils::EntryFieldNames.contains(attributeName)) {
|
||||
if (showDefaultAttributes) {
|
||||
out << attributeName << ": ";
|
||||
}
|
||||
out << Utils::getTopLevelField(entry, attributeName) << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
QStringList attrs = Utils::findAttributes(*entry->attributes(), attributeName);
|
||||
if (attrs.isEmpty()) {
|
||||
encounteredError = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue