Documentation ¶
Index ¶
- Constants
- type SplitFlags
- type UnitFile
- func (f *UnitFile) Add(groupName string, key string, value string)
- func (f *UnitFile) AddCmdline(groupName string, key string, args []string)
- func (f *UnitFile) AddComment(groupName string, comments ...string)
- func (f *UnitFile) Dup() *UnitFile
- func (f *UnitFile) GetTemplateParts() (string, string)
- func (f *UnitFile) HasGroup(groupName string) bool
- func (f *UnitFile) HasKey(groupName string, key string) bool
- func (f *UnitFile) ListGroups() []string
- func (f *UnitFile) ListKeys(groupName string) []string
- func (f *UnitFile) Lookup(groupName string, key string) (string, bool)
- func (f *UnitFile) LookupAll(groupName string, key string) []string
- func (f *UnitFile) LookupAllArgs(groupName string, key string) []string
- func (f *UnitFile) LookupAllKeyVal(groupName string, key string) map[string]string
- func (f *UnitFile) LookupAllRaw(groupName string, key string) []string
- func (f *UnitFile) LookupAllStrv(groupName string, key string) []string
- func (f *UnitFile) LookupBoolean(groupName string, key string) (bool, bool)
- func (f *UnitFile) LookupBooleanWithDefault(groupName string, key string, defaultValue bool) bool
- func (f *UnitFile) LookupGID(groupName string, key string, defaultValue uint32) (uint32, error)
- func (f *UnitFile) LookupInt(groupName string, key string, defaultValue int64) int64
- func (f *UnitFile) LookupLast(groupName string, key string) (string, bool)
- func (f *UnitFile) LookupLastArgs(groupName string, key string) ([]string, bool)
- func (f *UnitFile) LookupLastRaw(groupName string, key string) (string, bool)
- func (f *UnitFile) LookupUID(groupName string, key string, defaultValue uint32) (uint32, error)
- func (f *UnitFile) LookupUint32(groupName string, key string, defaultValue uint32) uint32
- func (f *UnitFile) Merge(source *UnitFile)
- func (f *UnitFile) Parse(data string) error
- func (f *UnitFile) PrependComment(groupName string, comments ...string)
- func (f *UnitFile) RemoveGroup(groupName string)
- func (f *UnitFile) RenameGroup(groupName string, newName string)
- func (f *UnitFile) Set(groupName string, key string, value string)
- func (f *UnitFile) Setv(groupName string, keyvals ...string)
- func (f *UnitFile) ToString() (string, error)
- func (f *UnitFile) Unset(groupName string, key string)
- func (f *UnitFile) Write(w io.Writer) error
- type UnitFileParser
Constants ¶
const WhitespaceSeparators = " \t\n\r"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SplitFlags ¶
type SplitFlags = uint64
const ( SplitRelax SplitFlags = 1 << iota // Allow unbalanced quote and eat up trailing backslash. SplitCUnescape // Unescape known escape sequences. SplitUnescapeRelax // Allow and keep unknown escape sequences, allow and keep trailing backslash. SplitUnescapeSeparators // Unescape separators (those specified, or whitespace by default). SplitKeepQuote // Ignore separators in quoting with "" and ”. SplitUnquote // Ignore separators in quoting with "" and ”, and remove the quotes. SplitDontCoalesceSeparators // Don't treat multiple adjacent separators as one SplitRetainEscape // Treat escape character '\' as any other character without special meaning SplitRetainSeparators // Do not advance the original string pointer past the separator(s) */ )
type UnitFile ¶
func ParseUnitFile ¶
Load a unit file from disk, remembering the path and filename
func (*UnitFile) AddCmdline ¶
func (*UnitFile) AddComment ¶
Empty group name == first group
func (*UnitFile) GetTemplateParts ¶
func (*UnitFile) ListGroups ¶
func (*UnitFile) Lookup ¶
Look up the last instance of the named key in the group (if any) The result have no trailing whitespace and line continuations are applied
func (*UnitFile) LookupAll ¶
Look up every instance of the named key in the group The result can have trailing whitespace, but line continuations are applied
func (*UnitFile) LookupAllArgs ¶
Look up every instance of the named key in the group, and for each, split space separated words (including handling quoted words) and combine them all into one array of words. The split code is exec-like, and both unquotes and applied c-style c escapes.
func (*UnitFile) LookupAllKeyVal ¶
Look up 'Environment' style key-value keys
func (*UnitFile) LookupAllRaw ¶
Look up every instance of the named key in the group The result can have trailing whitespace, and Raw means it can contain line continuations (\ at end of line)
func (*UnitFile) LookupAllStrv ¶
Look up every instance of the named key in the group, and for each, split space separated words (including handling quoted words) and combine them all into one array of words. The split code is compatible with the systemd config_parse_strv(). This is typically used by systemd keys like "RequiredBy" and "Aliases".
func (*UnitFile) LookupBoolean ¶
Lookup the last instance of a key and convert the value to a bool
func (*UnitFile) LookupBooleanWithDefault ¶
Lookup the last instance of a key and convert the value to a bool
func (*UnitFile) LookupGID ¶
Lookup the last instance of a key and convert a uid or a group name to an uint32 gid
func (*UnitFile) LookupLast ¶
Look up the last instance of the named key in the group (if any) The result can have trailing whitespace, but line continuations are applied
func (*UnitFile) LookupLastArgs ¶
Look up last instance of the named key in the group, and split space separated words (including handling quoted words) into one array of words. The split code is exec-like, and both unquotes and applied c-style c escapes. This is typically used for keys like ExecStart
func (*UnitFile) LookupLastRaw ¶
Look up the last instance of the named key in the group (if any) The result can have trailing whitespace, and Raw means it can contain line continuations (\ at end of line)
func (*UnitFile) LookupUID ¶
Lookup the last instance of a key and convert a uid or a user name to an uint32 uid
func (*UnitFile) LookupUint32 ¶
Lookup the last instance of a key and convert the value to an uint32
func (*UnitFile) PrependComment ¶
func (*UnitFile) RemoveGroup ¶
func (*UnitFile) RenameGroup ¶
type UnitFileParser ¶
type UnitFileParser struct {
// contains filtered or unexported fields
}