diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-07-05 23:03:06 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-07-05 23:03:06 -0400 |
| commit | cd9e250a0122f84c60f9cc49bab81801d71284ec (patch) | |
| tree | d23cc5feb2d45dd034d66f0eef1a7ec9aa16279c /src/Propellor/Property/ConfFile.hs | |
| parent | f07e85e89163517d0f69f6b19e425094ebd7d270 (diff) | |
Added Propellor.Property.FreeDesktop module.
This commit was sponsored by Trenton Cronholm on Patreon.
Diffstat (limited to 'src/Propellor/Property/ConfFile.hs')
| -rw-r--r-- | src/Propellor/Property/ConfFile.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Propellor/Property/ConfFile.hs b/src/Propellor/Property/ConfFile.hs index b49c626e..ce092ec9 100644 --- a/src/Propellor/Property/ConfFile.hs +++ b/src/Propellor/Property/ConfFile.hs @@ -11,6 +11,7 @@ module Propellor.Property.ConfFile ( containsIniSetting, hasIniSection, lacksIniSection, + iniFileContains, ) where import Propellor.Base @@ -114,3 +115,13 @@ lacksIniSection f header = adjustIniSection (const []) -- remove all lines of section id -- add no lines if section is missing f + +-- | Specifies the whole content of a .ini file. +-- +-- Revertijg this causes the file not to exist. +iniFileContains :: FilePath -> [(IniSection, [(IniKey, String)])] -> RevertableProperty UnixLike UnixLike +iniFileContains f l = f `hasContent` content <!> notPresent f + where + content = concatMap sectioncontent l + sectioncontent (section, keyvalues) = iniHeader section : + map (\(key, value) -> key ++ "=" ++ value) keyvalues |
