]> gitweb.michael.orlitzky.com - dead/halcyon.git/blobdiff - src/Configuration.hs
Rewrite CommandLine to use cmdargs and integrate the command-line and RC file options.
[dead/halcyon.git] / src / Configuration.hs
index b4b29f3687bb7e9429ab0959368841e208fc9ea1..39dd4e6f4cc46a58cd63be81471bbf2a80cfcbc0 100644 (file)
@@ -4,7 +4,9 @@
 --
 
 module Configuration (
-  Cfg(..)
+  Cfg(..),
+  default_config,
+  merge_optional
 )
 where
 
@@ -21,8 +23,9 @@ data Cfg =
         sendmail_path :: String,
         from_address :: Maybe String,
         to_address :: Maybe String,
-        verbose :: Bool }
-
+        verbose :: Bool,
+        usernames :: [String] }
+    deriving (Show)
 
 
 default_config :: Cfg
@@ -37,7 +40,8 @@ default_config =
         sendmail_path = "/usr/sbin/sendmail",
         from_address = Nothing,
         to_address = Nothing,
-        verbose = False }
+        verbose = False,
+        usernames = [] }
 
 merge_optional :: Cfg -> OC.OptionalCfg -> Cfg
 merge_optional cfg opt_cfg =
@@ -53,6 +57,7 @@ merge_optional cfg opt_cfg =
     (merge' (from_address cfg) (OC.from_address opt_cfg))
     (merge' (to_address cfg) (OC.to_address opt_cfg))
     (merge (verbose cfg) (OC.verbose opt_cfg))
+    ((usernames cfg) ++ (OC.usernames opt_cfg))
   where
     merge :: a -> Maybe a -> a
     merge x Nothing  = x