From 8a1887d6de5e7488293d3e6e0e281e4bd1761681 Mon Sep 17 00:00:00 2001 From: Mirko Westermeier Date: Wed, 10 Mar 2021 18:45:03 +0100 Subject: [PATCH] Deliver the whole data structure --- CHANGELOG.md | 4 ++++ src/Trivialini.hs | 6 +++++- trivialini.cabal | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f7d62..9c76528 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Revision history for trivialini +## 0.1.3.0 -- 2021-03-10 + +* Add a completeConfig method for the whole data structure + ## 0.1.2.0 -- 2021-03-07 * Simplify regex matching diff --git a/src/Trivialini.hs b/src/Trivialini.hs index d920d17..adb5a45 100644 --- a/src/Trivialini.hs +++ b/src/Trivialini.hs @@ -1,5 +1,5 @@ -- | Ultra light weight ini file parser -module Trivialini (config, configFile) where +module Trivialini (Config(..), completeConfig, config, configFile) where import Data.Map (Map, keys, empty, insert, (!)) import Text.Regex.TDFA ((=~)) @@ -71,6 +71,10 @@ rc sec values (line:lines) -- Public interface -- +-- | Return the complete config data from the given filename +completeConfig :: String -> IO Config +completeConfig file = readConfig <$> readFile file + -- | Return the config value for a given section and key from the given config config :: String -> String -> String -> String config = value . readConfig diff --git a/trivialini.cabal b/trivialini.cabal index 0a7fd11..9395b8e 100644 --- a/trivialini.cabal +++ b/trivialini.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: trivialini -version: 0.1.2.0 +version: 0.1.3.0 synopsis: Ultra light weight ini file parser -- description: homepage: https://github.com/memowe/trivialini