diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | commands/msgview/save.go | 17 | ||||
-rw-r--r-- | doc/aerc.1.scd | 4 | ||||
-rw-r--r-- | widgets/msgviewer.go | 4 |
4 files changed, 17 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c321b001..33876008 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added +- Add a `-A` option to `:save` for saving all the named parts, not just + attachments - Colorize can style diff chunk function names with `diff_chunk_func`. - Warn before sending emails with an empty subject with `empty-subject-warning` in `aerc.conf`. diff --git a/commands/msgview/save.go b/commands/msgview/save.go index 7d82ff95..5bd4c188 100644 --- a/commands/msgview/save.go +++ b/commands/msgview/save.go @@ -26,7 +26,7 @@ func init() { } func (Save) Options() string { - return "fpa" + return "fpaA" } func (Save) Aliases() []string { @@ -45,10 +45,11 @@ func (s Save) Complete(aerc *widgets.Aerc, args []string) []string { } type saveParams struct { - force bool - createDirs bool - trailingSlash bool - attachments bool + force bool + createDirs bool + trailingSlash bool + attachments bool + allAttachments bool } func (s Save) Execute(aerc *widgets.Aerc, args []string) error { @@ -67,6 +68,8 @@ func (s Save) Execute(aerc *widgets.Aerc, args []string) error { params.createDirs = true case 'a': params.attachments = true + case 'A': + params.allAttachments = true } } @@ -106,8 +109,8 @@ func (s Save) Execute(aerc *widgets.Aerc, args []string) error { return fmt.Errorf("SelectedTabContent is not a MessageViewer") } - if params.attachments { - parts := mv.AttachmentParts() + if params.attachments || params.allAttachments { + parts := mv.AttachmentParts(params.allAttachments) if len(parts) == 0 { return fmt.Errorf("This message has no attachments") } diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd index 0c89460b..a637960f 100644 --- a/doc/aerc.1.scd +++ b/doc/aerc.1.scd @@ -477,7 +477,7 @@ message list, the message in the message viewer, etc). the same than for *:open* but the opener program will be looked up according to the URL scheme MIME type: _x-scheme-handler/<scheme>_. -*:save* [*-fpa*] _<path>_ +*:save* [*-fpaA*] _<path>_ Saves the current message part to the given path. If the path is not an absolute path, *[general].default-save-path* from _aerc.conf_ will be prepended to the path given. @@ -492,6 +492,8 @@ message list, the message in the message viewer, etc). *-a*: Save all attachments. Individual filenames cannot be specified. + *-A*: Same as *-a* but saves all the named parts, not just attachments. + *:mark* [*-atvT*] Marks messages. Commands will execute on all marked messages instead of the highlighted one if applicable. The flags below can be combined as needed. diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 6752fbff..bb30734d 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -337,11 +337,11 @@ func (mv *MessageViewer) SelectedMessagePart() *PartInfo { } } -func (mv *MessageViewer) AttachmentParts() []*PartInfo { +func (mv *MessageViewer) AttachmentParts(all bool) []*PartInfo { var attachments []*PartInfo for _, p := range mv.switcher.parts { - if p.part.Disposition == "attachment" { + if p.part.Disposition == "attachment" || (all && p.part.FileName() != "") { pi := &PartInfo{ Index: p.index, Msg: p.msg.MessageInfo(), |