Fix passing multiple attachments to the CLI

Also updated the related zsh autocompletion.
This commit is contained in:
Matthijs Tijink 2020-10-31 12:21:53 +01:00 committed by Nicolas Fella
parent 06d81412b6
commit 9d503bc893
2 changed files with 4 additions and 3 deletions

View file

@ -53,7 +53,7 @@ int main(int argc, char** argv)
parser.addOption(QCommandLineOption(QStringLiteral("lock"), i18n("Lock the specified device"))); 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("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("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("device")) << QStringLiteral("d"), i18n("Device ID"), QStringLiteral("dev")));
parser.addOption(QCommandLineOption(QStringList(QStringLiteral("name")) << QStringLiteral("n"), i18n("Device Name"), QStringLiteral("name"))); 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"))); 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 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; QVariantList attachments;
for (const QString& attachmentUrl : rawAttachmentUrlsList) { for (const QString& attachmentUrl : rawAttachmentUrlsList) {

View file

@ -44,4 +44,5 @@ _arguments -s \
$blockoperations"--photo=[open the connected device's camera and transfer the photo]:file:_files" \ $blockoperations"--photo=[open the connected device's camera and transfer the photo]:file:_files" \
+ 'sms' \ + 'sms' \
'(operation)--send-sms=[send an SMS]:message:' \ '(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'