c0c924b75a
ADDED: * auger, some convenience funcs around Augeas.
63 lines
1.9 KiB
Go
63 lines
1.9 KiB
Go
package auger
|
|
|
|
import (
|
|
`honnef.co/go/augeas`
|
|
)
|
|
|
|
// Aug is a wrapper around (honnef.co/go/)augeas.Augeas. Remember to call Aug.Close().
|
|
type Aug struct {
|
|
aug augeas.Augeas
|
|
}
|
|
|
|
// AugFlags contains flags to pass to the Augeas instance.
|
|
type AugFlags struct {
|
|
/*
|
|
Backup, if true, will enable Augeas backup mode (original files are saved with a .augsave suffix).
|
|
const: augeas.SaveBackup
|
|
*/
|
|
Backup *bool `toml:"Backup,omitempty"`
|
|
/*
|
|
NewFile, if true, will create new files (.augnew suffix) instead of overwriting the original file.
|
|
const: augeas.SaveNewFile
|
|
*/
|
|
NewFile *bool `toml:"NewFile,omitempty"`
|
|
/*
|
|
TypeCheck, if true, will perform a Lens typecheck.
|
|
HIGHLY UNRECOMMENDED; WILL INDUCE A HUGE FRONTLOAD.
|
|
const: augeas.TypeCheck
|
|
*/
|
|
TypeCheck *bool `toml:"TypeCheck,omitempty"`
|
|
/*
|
|
NoDfltModLoad, if true, will suppress loading the built-in/default modules.
|
|
Highly unrecommended, as we do not have a current way in the config to define load paths (yet).
|
|
const: augeas.NoStdinc
|
|
*/
|
|
NoDfltModLoad *bool `toml:"NoDfltModLoad,omitempty"`
|
|
/*
|
|
DryRun, if true, will make all saves NO-OPs.
|
|
const: augeas.SaveNoop
|
|
*/
|
|
DryRun *bool `toml:"DryRun,omitempty"`
|
|
/*
|
|
NoTree, if true, will not load the filetree automatically. Doesn't really affect this program.
|
|
const: augeas.NoLoad
|
|
*/
|
|
NoTree *bool `toml:"NoTree,omitempty"`
|
|
/*
|
|
NoAutoModLoad, if true, will supress automatically loading modules.
|
|
const: augeas.NoModlAutoload
|
|
*/
|
|
NoAutoModLoad *bool `toml:"NoAutoModLoad,omitempty"`
|
|
/*
|
|
EnableSpan, if true, will track span in input nodes (location information, essentially).
|
|
See https://augeas.net/docs/api.html#getting-the-span-of-a-node-related-to-a-file
|
|
const: augeas.EnableSpan
|
|
*/
|
|
EnableSpan *bool `toml:"EnableSpan,omitempty"`
|
|
/*
|
|
NoErrClose, if true, will suppress automatically closing on error.
|
|
const: augeas.NoErrClose
|
|
*/
|
|
NoErrClose *bool `toml:"NoErrClose,omitempty"`
|
|
}
|