aboutsummaryrefslogtreecommitdiff
path: root/commands/msgview/toggle-headers.go
blob: fc29042d4181b993994ce52743988e14c1af9276 (plain)
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
package msgview

import (
	"errors"
	"fmt"

	"git.sr.ht/~sircmpwn/aerc/widgets"
)

func init() {
	register("toggle-headers", ToggleHeaders)
}

func toggleHeadersUsage(cmd string) error {
	return errors.New(fmt.Sprintf("Usage: %s", cmd))
}

func ToggleHeaders(aerc *widgets.Aerc, args []string) error {
	if len(args) > 1 {
		return toggleHeadersUsage(args[0])
	}
	mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
	mv.ToggleHeaders()
	return nil
}