diff --git a/src/main/java/org/asamk/signal/commands/RemoteDeleteCommand.java b/src/main/java/org/asamk/signal/commands/RemoteDeleteCommand.java index 81da8a27..40d9a730 100644 --- a/src/main/java/org/asamk/signal/commands/RemoteDeleteCommand.java +++ b/src/main/java/org/asamk/signal/commands/RemoteDeleteCommand.java @@ -26,9 +26,14 @@ public class RemoteDeleteCommand implements DbusCommand { .required(true) .type(long.class) .help("Specify the timestamp of the message to delete."); - var mut = subparser.addMutuallyExclusiveGroup(); - mut.addArgument("-g", "--group").help("Specify the recipient group ID."); - mut.addArgument("recipient").help("Specify the recipients' phone number.").nargs("*"); + var mut = subparser.addMutuallyExclusiveGroup() + .required(true); + mut.addArgument("-g", "--group") + .required(false) + .help("Specify the recipient group ID."); + mut.addArgument("recipient") + .required(false) + .help("Specify the recipients' phone number.").nargs("*"); } @Override @@ -36,6 +41,8 @@ public class RemoteDeleteCommand implements DbusCommand { final List recipients = ns.getList("recipient"); final var groupIdString = ns.getString("group"); + // Possibly unnecessary (see above — recipient(s) or group is required), + // but just for case... final var noRecipients = recipients == null || recipients.isEmpty(); if (noRecipients && groupIdString == null) { throw new UserErrorException("No recipients given");