2d5c0865c7
ADDED: * A way to actually use Auger externally. lel.
46 lines
893 B
Go
46 lines
893 B
Go
package auger
|
|
|
|
import (
|
|
`honnef.co/go/augeas`
|
|
)
|
|
|
|
// Eval returns an evaluated set of flags.
|
|
func (a *AugFlags) Eval() (augFlags augeas.Flag) {
|
|
|
|
if a == nil {
|
|
return
|
|
}
|
|
|
|
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
|
|
}
|