X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/2e4d346bc826da5c35a17841772cf81ba4f98101..e6cf11cb3de2d2a684189de7561fca1c520c60d0:/src/main/java/org/asamk/signal/commands/GetAttachmentCommand.java diff --git a/src/main/java/org/asamk/signal/commands/GetAttachmentCommand.java b/src/main/java/org/asamk/signal/commands/GetAttachmentCommand.java index 560be9f9..6deed90a 100644 --- a/src/main/java/org/asamk/signal/commands/GetAttachmentCommand.java +++ b/src/main/java/org/asamk/signal/commands/GetAttachmentCommand.java @@ -26,27 +26,20 @@ public class GetAttachmentCommand implements JsonRpcLocalCommand { @Override public void attachToSubparser(final Subparser subparser) { - subparser.addArgument("--id") - .required(true) - .help("The ID of the attachment file."); - var mut = subparser.addMutuallyExclusiveGroup() - .required(true); - mut.addArgument("--recipient") - .help("Sender of the attachment"); - mut.addArgument("-g", "--group-id") - .help("Group in which the attachment was received"); + subparser.addArgument("--id").required(true).help("The ID of the attachment file."); + var mut = subparser.addMutuallyExclusiveGroup().required(true); + mut.addArgument("--recipient").help("Sender of the attachment"); + mut.addArgument("-g", "--group-id").help("Group in which the attachment was received"); } @Override public void handleCommand( - final Namespace ns, - final Manager m, - final OutputWriter outputWriter + final Namespace ns, final Manager m, final OutputWriter outputWriter ) throws CommandException { final var id = ns.getString("id"); - try(InputStream attachment = m.retrieveAttachment(id)) { + try (InputStream attachment = m.retrieveAttachment(id)) { if (outputWriter instanceof PlainTextWriter writer) { final var bytes = attachment.readAllBytes(); final var base64 = Base64.getEncoder().encodeToString(bytes);