CLI: Add commands to handle attachments

* Add commands to manipulate entry attachments from the CLI
* Closes #4462

* Add the following commands:
  attachment-export: Exports the content of an attachment to a specified file.

  attachment-import: Imports the attachment into an entry. An existing attachment with the same name may be overwritten if the -f option is specified.

  attachment-rm: Removes the named attachment from an entry.

* Add --show-attachments  to the show command
This commit is contained in:
Andre Blanke 2021-11-03 23:29:44 -04:00 committed by Jonathan White
parent 7811f10dba
commit 7d37f65ad0
16 changed files with 697 additions and 3 deletions

View file

@ -18,6 +18,9 @@
#include "Add.h"
#include "AddGroup.h"
#include "Analyze.h"
#include "AttachmentExport.h"
#include "AttachmentImport.h"
#include "AttachmentRemove.h"
#include "Clip.h"
#include "Close.h"
#include "Create.h"
@ -107,7 +110,7 @@ QString Command::getDescriptionLine()
{
QString response = name;
QString space(" ");
QString spaces = space.repeated(15 - name.length());
QString spaces = space.repeated(20 - name.length());
response = response.append(spaces);
response = response.append(description);
response = response.append("\n");
@ -164,6 +167,9 @@ namespace Commands
s_commands.insert(QStringLiteral("add"), QSharedPointer<Command>(new Add()));
s_commands.insert(QStringLiteral("analyze"), QSharedPointer<Command>(new Analyze()));
s_commands.insert(QStringLiteral("attachment-export"), QSharedPointer<Command>(new AttachmentExport()));
s_commands.insert(QStringLiteral("attachment-import"), QSharedPointer<Command>(new AttachmentImport()));
s_commands.insert(QStringLiteral("attachment-rm"), QSharedPointer<Command>(new AttachmentRemove()));
s_commands.insert(QStringLiteral("clip"), QSharedPointer<Command>(new Clip()));
s_commands.insert(QStringLiteral("close"), QSharedPointer<Command>(new Close()));
s_commands.insert(QStringLiteral("db-create"), QSharedPointer<Command>(new Create()));