diff options
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | commands/compose/attach.go | 10 | ||||
-rw-r--r-- | doc/aerc-config.5.scd | 12 |
3 files changed, 19 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ff6bbd0..8acb37e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Remove headers from the compose window with `:header -d <name>`. - Add option `-r` to `:attach` to pipe the attachments in. - Add `msglist_gutter` and `msglist_pill` styles for message list scrollbar. +- Add `%f` placeholder to `file-picker-cmd` which expands to a location of a + temporary file from which selected files will be read instead of the standard + output. ### Fixed diff --git a/commands/compose/attach.go b/commands/compose/attach.go index 2eb8a98d..3f6d124f 100644 --- a/commands/compose/attach.go +++ b/commands/compose/attach.go @@ -154,8 +154,14 @@ func (a Attach) openMenu(aerc *widgets.Aerc, args []string) error { return err } - filepicker := exec.Command("sh", "-c", filePickerCmd+" >&3") - filepicker.ExtraFiles = append(filepicker.ExtraFiles, picks) + var filepicker *exec.Cmd + if strings.Contains(filePickerCmd, "%f") { + filePickerCmd = strings.ReplaceAll(filePickerCmd, "%f", picks.Name()) + filepicker = exec.Command("sh", "-c", filePickerCmd) + } else { + filepicker = exec.Command("sh", "-c", filePickerCmd+" >&3") + filepicker.ExtraFiles = append(filepicker.ExtraFiles, picks) + } t, err := widgets.NewTerminal(filepicker) if err != nil { 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* = _<command>_ Specifies the command to be used to select attachments. Any occurrence of _%s_ in the *file-picker-cmd* will be replaced with the argument _<arg>_ - to *:attach -m* _<arg>_. + to *:attach -m* _<arg>_. 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 |