commands/helper: remove duplicated method
This commit is contained in:
parent
c5fdefe7af
commit
381c1fc05f
|
@ -44,7 +44,7 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h := newHelper(aerc)
|
h := newHelper(aerc)
|
||||||
uids, err := h.uids()
|
uids, err := h.markedOrSelectedUids()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
uids, err := h.uids()
|
uids, err := h.markedOrSelectedUids()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
uids, err := h.uids()
|
uids, err := h.markedOrSelectedUids()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
uids, err := h.uids()
|
uids, err := h.markedOrSelectedUids()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ func (Read) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
// ignore commmand given, simply toggle all the read states
|
// ignore commmand given, simply toggle all the read states
|
||||||
return submitToggle(aerc, store, h)
|
return submitToggle(aerc, store, h)
|
||||||
}
|
}
|
||||||
msgUids, err := h.messageUids()
|
msgUids, err := h.markedOrSelectedUids()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ func newHelper(aerc *widgets.Aerc) *helper {
|
||||||
return &helper{aerc.SelectedTab().(widgets.ProvidesMessages)}
|
return &helper{aerc.SelectedTab().(widgets.ProvidesMessages)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *helper) uids() ([]uint32, error) {
|
func (h *helper) markedOrSelectedUids() ([]uint32, error) {
|
||||||
msgs, err := commands.MarkedOrSelected(h.msgProvider)
|
msgs, err := commands.MarkedOrSelected(h.msgProvider)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -45,11 +45,3 @@ func (h *helper) account() (*widgets.AccountView, error) {
|
||||||
func (h *helper) messages() ([]*models.MessageInfo, error) {
|
func (h *helper) messages() ([]*models.MessageInfo, error) {
|
||||||
return commands.MarkedOrSelected(h.msgProvider)
|
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 New Issue