mirror of
https://github.com/wagoodman/dive
synced 2026-03-14 22:35:50 +01:00
26 lines
705 B
Go
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
|
|
}
|