go_sysutils/auger/funcs_augflags.go

42 lines
865 B
Go
Raw Normal View History

package auger
import (
`honnef.co/go/augeas`
)
// Eval returns an evaluated set of flags.
func (a *AugFlags) Eval() (augFlags augeas.Flag) {
augFlags = augeas.None
if a.Backup != nil && *a.Backup {
augFlags |= augeas.SaveBackup
}
if a.NewFile != nil && *a.NewFile {
augFlags |= augeas.SaveNewFile
}
if a.TypeCheck != nil && *a.TypeCheck {
augFlags |= augeas.TypeCheck
}
if a.NoDfltModLoad != nil && *a.NoDfltModLoad {
augFlags |= augeas.NoModlAutoload
}
if a.DryRun != nil && *a.DryRun {
augFlags |= augeas.SaveNoop
}
if a.NoTree != nil && *a.NoTree {
augFlags |= augeas.NoLoad
}
if a.NoAutoModLoad != nil && *a.NoAutoModLoad {
augFlags |= augeas.NoModlAutoload
}
if a.EnableSpan != nil && *a.EnableSpan {
augFlags |= augeas.EnableSpan
}
if a.NoErrClose != nil && *a.NoErrClose {
augFlags |= augeas.NoErrClose
}
return
}