summaryrefslogtreecommitdiffstats
path: root/runtime/config/diff_config.go
blob: 761af23cac853d894a2dba9a8d88598ae7107323 (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
26
package config

import "github.com/wagoodman/dive/dive/filetree"

type diffConfig struct {
	// note: this really relates to the fileTreeViewConfig, but is here for legacy reasons
	Hide      []string            `mapstructure:"hide"`
	DiffTypes []filetree.DiffType `yaml:"-"`
}

func (c *diffConfig) build() error {
	c.DiffTypes = nil
	for _, hideType := range c.Hide {
		switch hideType {
		case "added":
			c.DiffTypes = append(c.DiffTypes, filetree.Added)
		case "removed":
			c.DiffTypes = append(c.DiffTypes, filetree.Removed)
		case "modified":
			c.DiffTypes = append(c.DiffTypes, filetree.Modified)
		case "unmodified":
			c.DiffTypes = append(c.DiffTypes, filetree.Unmodified)
		}
	}
	return nil
}