Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type SectionStart = Line -> Bool
- type SectionPast = Line -> Bool
- type AdjustSection = [Line] -> [Line]
- type InsertSection = [Line] -> [Line]
- adjustSection :: Desc -> SectionStart -> SectionPast -> AdjustSection -> InsertSection -> FilePath -> Property UnixLike
- type IniSection = String
- type IniKey = String
- containsIniSetting :: FilePath -> (IniSection, IniKey, String) -> Property UnixLike
- lacksIniSetting :: FilePath -> (IniSection, IniKey, String) -> Property UnixLike
- hasIniSection :: FilePath -> IniSection -> [(IniKey, String)] -> Property UnixLike
- lacksIniSection :: FilePath -> IniSection -> Property UnixLike
- iniFileContains :: FilePath -> [(IniSection, [(IniKey, String)])] -> RevertableProperty UnixLike UnixLike
- type ShellKey = String
- containsShellSetting :: FilePath -> (ShellKey, String) -> Property UnixLike
- lacksShellSetting :: FilePath -> (ShellKey, String) -> Property UnixLike
Generic conffiles with sections
type SectionStart = Line -> Bool Source #
find the line that is the start of the wanted section (eg, == "Foo")
type SectionPast = Line -> Bool Source #
find a line that indicates we are past the section (eg, a new section header)
type AdjustSection = [Line] -> [Line] Source #
run on all lines in the section, including the SectionStart line; can add, delete, and modify lines, or even delete entire section
type InsertSection = [Line] -> [Line] Source #
if SectionStart does not find the section in the file, this is used to insert the section somewhere within it
adjustSection :: Desc -> SectionStart -> SectionPast -> AdjustSection -> InsertSection -> FilePath -> Property UnixLike Source #
Adjusts a section of conffile.
Windows .ini files
type IniSection = String Source #
Name of a section of an .ini file. This value is put in square braces to generate the section header.
containsIniSetting :: FilePath -> (IniSection, IniKey, String) -> Property UnixLike Source #
Ensures that a .ini file exists and contains a section with a key=value setting.
lacksIniSetting :: FilePath -> (IniSection, IniKey, String) -> Property UnixLike Source #
Removes a key=value setting from a section of an .ini file. Note that the section heading is left in the file, so this is not a perfect reversion of containsIniSetting.
hasIniSection :: FilePath -> IniSection -> [(IniKey, String)] -> Property UnixLike Source #
Ensures that a .ini file exists and contains a section with a given key=value list of settings.
lacksIniSection :: FilePath -> IniSection -> Property UnixLike Source #
Ensures that a .ini file does not contain the specified section.
iniFileContains :: FilePath -> [(IniSection, [(IniKey, String)])] -> RevertableProperty UnixLike UnixLike Source #
Specifies the whole content of a .ini file.
Revertijg this causes the file not to exist.
Conffiles that are actually shell scripts setting env vars
type ShellKey = String Source #
Key for a shell conffile property. Conventionally uppercase letters and numbers with underscores for separators. See files in /etc/default.
containsShellSetting :: FilePath -> (ShellKey, String) -> Property UnixLike Source #
Ensures a shell conffile (like those in /etc/default) exists and has a key=value pair.
Comments out any further settings of that key further down the file, to avoid those taking precedence.
lacksShellSetting :: FilePath -> (ShellKey, String) -> Property UnixLike Source #
Comments out a key=value pair in a shell conffile.
Does not delete the file if empty, and does not uncomment any
lines, so not a perfect reversion of containsShellSetting
.