dive/runtime/config/diff_config.go
2021-02-15 13:13:08 -05:00

26 lines
705 B
Go

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
}