From 9d503bc893948fde4eb2b64d0c7731b91171c1c2 Mon Sep 17 00:00:00 2001 From: Matthijs Tijink Date: Sat, 31 Oct 2020 12:21:53 +0100 Subject: [PATCH] Fix passing multiple attachments to the CLI Also updated the related zsh autocompletion. --- cli/kdeconnect-cli.cpp | 4 ++-- cli/kdeconnect.zsh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index fa2bd839d..3096629b8 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -53,7 +53,7 @@ int main(int argc, char** argv) parser.addOption(QCommandLineOption(QStringLiteral("lock"), i18n("Lock the specified device"))); parser.addOption(QCommandLineOption(QStringLiteral("send-sms"), i18n("Sends an SMS. Requires destination"), i18n("message"))); parser.addOption(QCommandLineOption(QStringLiteral("destination"), i18n("Phone number to send the message"), i18n("phone number"))); - parser.addOption(QCommandLineOption(QStringLiteral("attachment"), i18n("File urls to send attachments with the message"), i18n("file urls"))); + parser.addOption(QCommandLineOption(QStringLiteral("attachment"), i18n("File urls to send attachments with the message (can be passed multiple times)"), i18n("file urls"))); parser.addOption(QCommandLineOption(QStringList(QStringLiteral("device")) << QStringLiteral("d"), i18n("Device ID"), QStringLiteral("dev"))); parser.addOption(QCommandLineOption(QStringList(QStringLiteral("name")) << QStringLiteral("n"), i18n("Device Name"), QStringLiteral("name"))); parser.addOption(QCommandLineOption(QStringLiteral("encryption-info"), i18n("Get encryption info about said device"))); @@ -261,7 +261,7 @@ int main(int argc, char** argv) const QString message = parser.value(QStringLiteral("send-sms")); - const QStringList rawAttachmentUrlsList = parser.value(QStringLiteral("attachment")).split(QRegularExpression(QStringLiteral("\\s+"))); + const QStringList rawAttachmentUrlsList = parser.values(QStringLiteral("attachment")); QVariantList attachments; for (const QString& attachmentUrl : rawAttachmentUrlsList) { diff --git a/cli/kdeconnect.zsh b/cli/kdeconnect.zsh index 15ae27cee..45464af0e 100644 --- a/cli/kdeconnect.zsh +++ b/cli/kdeconnect.zsh @@ -44,4 +44,5 @@ _arguments -s \ $blockoperations"--photo=[open the connected device's camera and transfer the photo]:file:_files" \ + 'sms' \ '(operation)--send-sms=[send an SMS]:message:' \ - '(operation)--destination=[specify phone number to send the SMS to]:phone number:' + '(operation)--destination=[specify phone number to send the SMS to]:phone number:' \ + '(operation)*--attachment=[attachment to send with the message]:file:_files'