summary refs log tree commit diff stats
path: root/commands
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-05-09 11:50:30 +0200
committerDrew DeVault <sir@cmpwn.com>2020-05-11 09:47:33 -0400
commit381c1fc05f6de95accbb520769d0cc9196955cf4 (patch)
tree562c004d3153959995aaeb85660f4ead9b4e15f5 /commands
parentc5fdefe7afdc69fc4eefd1ccd702a60b39fc6cb9 (diff)
downloadaerc-381c1fc05f6de95accbb520769d0cc9196955cf4.tar.gz
commands/helper: remove duplicated method
Diffstat (limited to 'commands')
-rw-r--r--commands/msg/copy.go2
-rw-r--r--commands/msg/delete.go2
-rw-r--r--commands/msg/modify-labels.go2
-rw-r--r--commands/msg/move.go2
-rw-r--r--commands/msg/read.go2
-rw-r--r--commands/msg/utils.go10
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
-}
lass="nt">br><a href="file:/home/hut/code/ranger/ranger/__init__.py">/home/hut/code/ranger/ranger/__init__.py</a></font></td></tr></table> <p><tt>Ranger&nbsp;-&nbsp;file&nbsp;browser&nbsp;for&nbsp;the&nbsp;unix&nbsp;terminal</tt></p> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#aa55cc"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Package Contents</strong></big></font></td></tr> <tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="ranger.__main__.html">__main__</a><br> <a href="ranger.api.html"><strong>api</strong>&nbsp;(package)</a><br> <a href="ranger.colorschemes.html"><strong>colorschemes</strong>&nbsp;(package)</a><br> </td><td width="25%" valign=top><a href="ranger.container.html"><strong>container</strong>&nbsp;(package)</a><br> <a href="ranger.core.html"><strong>core</strong>&nbsp;(package)</a><br> <a href="ranger.defaults.html"><strong>defaults</strong>&nbsp;(package)</a><br> </td><td width="25%" valign=top><a href="ranger.ext.html"><strong>ext</strong>&nbsp;(package)</a><br> <a href="ranger.fsobject.html"><strong>fsobject</strong>&nbsp;(package)</a><br> <a href="ranger.gui.html"><strong>gui</strong>&nbsp;(package)</a><br> </td><td width="25%" valign=top><a href="ranger.help.html"><strong>help</strong>&nbsp;(package)</a><br> <a href="ranger.shared.html"><strong>shared</strong>&nbsp;(package)</a><br> </td></tr></table></td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#eeaa77"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> <tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><dl><dt><a name="-log"><strong>log</strong></a>(*objects, **keywords)</dt><dd><tt>Writes&nbsp;objects&nbsp;to&nbsp;a&nbsp;logfile&nbsp;(for&nbsp;the&nbsp;purpose&nbsp;of&nbsp;debugging&nbsp;only.)<br> Has&nbsp;the&nbsp;same&nbsp;arguments&nbsp;as&nbsp;print()&nbsp;in&nbsp;python3.</tt></dd></dl> <dl><dt><a name="-relpath"><strong>relpath</strong></a>(*paths)</dt><dd><tt>returns&nbsp;the&nbsp;path&nbsp;relative&nbsp;to&nbsp;rangers&nbsp;library&nbsp;directory</tt></dd></dl> <dl><dt><a name="-relpath_conf"><strong>relpath_conf</strong></a>(*paths)</dt><dd><tt>returns&nbsp;the&nbsp;path&nbsp;relative&nbsp;to&nbsp;rangers&nbsp;configuration&nbsp;directory</tt></dd></dl> </td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#55aa55"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> <tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><strong>DEFAULT_CONFDIR</strong> = '~/.ranger'<br> <strong>LOGFILE</strong> = '/tmp/errorlog'<br> <strong>RANGERDIR</strong> = '/home/hut/code/ranger/ranger'<br> <strong>USAGE</strong> = '%prog [options] [path/filename]'<br> <strong>__author__</strong> = 'Roman Zimbelmann'<br> <strong>__copyright__</strong> = '<font color="#c040c0">\n</font>Copyright (C) 2009, 2010 Roman Zimbelmann &lt;romanz@lavabit.com&gt;<font color="#c040c0">\n</font>'<br> <strong>__credits__</strong> = 'Roman Zimbelmann'<br> <strong>__email__</strong> = 'romanz@lavabit.com'<br> <strong>__license__</strong> = 'GPL3'<br> <strong>__maintainer__</strong> = 'Roman Zimbelmann'<br> <strong>__version__</strong> = '1.1.0'<br> <strong>arg</strong> = {'debug': False, 'flags': '', 'mode': 0, 'clean': False, 'confdir': '~/.ranger', 'targets': []}</td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#7799ee"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> <tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%">Roman&nbsp;Zimbelmann</td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#7799ee"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Credits</strong></big></font></td></tr> <tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%">Roman&nbsp;Zimbelmann</td></tr></table> </body></html>