From 180fffa92ec7e9bc4a957be75f286f1f0d120ad6 Mon Sep 17 00:00:00 2001 From: Karel Balej Date: Tue, 15 Aug 2023 19:53:04 +0200 Subject: commands: allow reading attachments from a file Currently, aerc reads a list of files to be attached to a message from the file-picker-cmd's standard output. However, this doesn't play nice with ranger which seems to draw itself by writing there, causing it to be invisible in the embedded terminal. In fact, instead of using a pipe, aerc redirects the output of the command to a temporary file and then reads the list of files from there. Take advantage of this approach and allow user to directly reference this temporary file in the file-picker-cmd via the %f placeholder, which gets expanded to the temporary file's location. If the %f placeholder isn't present, keep the old behaviour. So for example, now it is possible to do: file-picker-cmd=ranger --choosefiles=%f in aerc.conf. Signed-off-by: Karel Balej Acked-by: Robin Jarry Reviewed-by: Tim Culverhouse --- doc/aerc-config.5.scd | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'doc/aerc-config.5.scd') diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd index c4d7195e..b09ce53e 100644 --- a/doc/aerc-config.5.scd +++ b/doc/aerc-config.5.scd @@ -570,13 +570,17 @@ These options are configured in the *[compose]* section of _aerc.conf_. *file-picker-cmd* = __ Specifies the command to be used to select attachments. Any occurrence of _%s_ in the *file-picker-cmd* will be replaced with the argument __ - to *:attach -m* __. + to *:attach -m* __. Any occurence of _%f_ will be replaced by the + location of a temporary file, from which aerc will read the selected files. - The command must output the selected files to standard output, - one file per line. + If _%f_ is not present, the command must output the selected files to + standard output, one file per line. If it is present, then aerc does not + capture the standard output and instead reads the files from the temporary + file which should have the same format. - Example: + Examples: *file-picker-cmd* = _fzf --multi --query=%s_ + *file-picker-cmd* = _ranger --choose-files=%f_ *reply-to-self* = _true_|_false_ If set to _false_, do not mail yourself when replying (e.g., if replying -- cgit