commands/helper: remove duplicated method

This commit is contained in:
Reto Brunner 2020-05-09 11:50:30 +02:00 committed by Drew DeVault
parent c5fdefe7af
commit 381c1fc05f
6 changed files with 6 additions and 14 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}