~sircmpwn/aerc

bdb5e3e6581169bdb1d912c158336f409151b491 — Wagner Riffel 1 year, 4 months ago baa7046
commands: move ParseNextPrevMessage error value to its last return value

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2 files changed, 6 insertions(+), 6 deletions(-)

M commands/account/next.go
M commands/msgview/next.go
M commands/account/next.go => commands/account/next.go +5 -5
@@ 23,8 23,8 @@ func (NextPrevMsg) Complete(aerc *widgets.Aerc, args []string) []string {
	return nil
}

	var err, n, pct = ParseNextPrevMessage(args)
func (NextPrevMsg) Execute(aerc *widgets.Aerc, args []string) error {
	n, pct, err := ParseNextPrevMessage(args)
	if err != nil {
		return err
	}


@@ 35,9 35,9 @@ func (NextPrevMsg) Execute(aerc *widgets.Aerc, args []string) error {
	return ExecuteNextPrevMessage(args, acct, pct, n)
}

func ParseNextPrevMessage(args []string) (error, int, bool) {
func ParseNextPrevMessage(args []string) (int, bool, error) {
	if len(args) > 2 {
		return nextPrevMessageUsage(args[0]), 0, false
		return 0, false, nextPrevMessageUsage(args[0])
	}
	var (
		n   int = 1


@@ 51,10 51,10 @@ func ParseNextPrevMessage(args []string) (error, int, bool) {
		}
		n, err = strconv.Atoi(args[1])
		if err != nil {
			return nextPrevMessageUsage(args[0]), 0, false
			return 0, false, nextPrevMessageUsage(args[0])
		}
	}
	return nil, n, pct
	return n, pct, nil
}

func ExecuteNextPrevMessage(args []string, acct *widgets.AccountView, pct bool, n int) error {

M commands/msgview/next.go => commands/msgview/next.go +1 -1
@@ 19,8 19,8 @@ func (NextPrevMsg) Complete(aerc *widgets.Aerc, args []string) []string {
	return nil
}

	err, n, pct := account.ParseNextPrevMessage(args)
func (NextPrevMsg) Execute(aerc *widgets.Aerc, args []string) error {
	n, pct, err := account.ParseNextPrevMessage(args)
	if err != nil {
		return err
	}