aboutsummaryrefslogtreecommitdiffstats
path: root/commands/next-tab.go
blob: d837419185c460f1b4710b1d85b30a9c69a775ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package commands

import (
	"git.sr.ht/~rjarry/aerc/app"
)

type NextPrevTab struct {
	Offset int `opt:"n" default:"1"`
}

func init() {
	register(NextPrevTab{})
}

func (NextPrevTab) Aliases() []string {
	return []string{"next-tab", "prev-tab"}
}

func (NextPrevTab) Complete(args []string) []string {
	return nil
}

func (np NextPrevTab) Execute(args []string) error {
	for n := 0; n < np.Offset; n++ {
		if args[0] == "prev-tab" {
			app.PrevTab()
		} else {
			app.NextTab()
		}
	}
	app.UpdateStatus()
	return nil
}