From 381c1fc05f6de95accbb520769d0cc9196955cf4 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sat, 9 May 2020 11:50:30 +0200 Subject: [PATCH] commands/helper: remove duplicated method --- commands/msg/copy.go | 2 +- commands/msg/delete.go | 2 +- commands/msg/modify-labels.go | 2 +- commands/msg/move.go | 2 +- commands/msg/read.go | 2 +- commands/msg/utils.go | 10 +--------- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/commands/msg/copy.go b/commands/msg/copy.go index 3eca565..f3d4030 100644 --- a/commands/msg/copy.go +++ b/commands/msg/copy.go @@ -44,7 +44,7 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error { } } h := newHelper(aerc) - uids, err := h.uids() + uids, err := h.markedOrSelectedUids() if err != nil { return err } diff --git a/commands/msg/delete.go b/commands/msg/delete.go index 0d2c1c5..313e3ea 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -34,7 +34,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error { if err != nil { return err } - uids, err := h.uids() + uids, err := h.markedOrSelectedUids() if err != nil { return err } diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go index 92899ec..f91075a 100644 --- a/commands/msg/modify-labels.go +++ b/commands/msg/modify-labels.go @@ -34,7 +34,7 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error { if err != nil { return err } - uids, err := h.uids() + uids, err := h.markedOrSelectedUids() if err != nil { return err } diff --git a/commands/msg/move.go b/commands/msg/move.go index 9542613..830e752 100644 --- a/commands/msg/move.go +++ b/commands/msg/move.go @@ -49,7 +49,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error { if err != nil { return err } - uids, err := h.uids() + uids, err := h.markedOrSelectedUids() if err != nil { return err } diff --git a/commands/msg/read.go b/commands/msg/read.go index d27c482..dcb9657 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -54,7 +54,7 @@ func (Read) Execute(aerc *widgets.Aerc, args []string) error { // ignore commmand given, simply toggle all the read states return submitToggle(aerc, store, h) } - msgUids, err := h.messageUids() + msgUids, err := h.markedOrSelectedUids() if err != nil { return err } diff --git a/commands/msg/utils.go b/commands/msg/utils.go index 30a4394..ae25535 100644 --- a/commands/msg/utils.go +++ b/commands/msg/utils.go @@ -17,7 +17,7 @@ func newHelper(aerc *widgets.Aerc) *helper { return &helper{aerc.SelectedTab().(widgets.ProvidesMessages)} } -func (h *helper) uids() ([]uint32, error) { +func (h *helper) markedOrSelectedUids() ([]uint32, error) { msgs, err := commands.MarkedOrSelected(h.msgProvider) if err != nil { return nil, err @@ -45,11 +45,3 @@ func (h *helper) account() (*widgets.AccountView, error) { func (h *helper) messages() ([]*models.MessageInfo, error) { return commands.MarkedOrSelected(h.msgProvider) } - -func (h *helper) messageUids() ([]uint32, error) { - msgs, err := h.messages() - if err != nil { - return nil, err - } - return commands.UidsFromMessageInfos(msgs), nil -}