commands/helper: remove duplicated method
This commit is contained in:
parent
c5fdefe7af
commit
381c1fc05f
6 changed files with 6 additions and 14 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue