X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FOptionalConfiguration.hs;h=2d74d27965e1281f0e816ae45500af9221f67440;hb=39e047ccd8422207e01247c63f514c40e7eac31e;hp=6bf4f9b35d7db66df049634a7348ecd27a4b60c1;hpb=7a6ba612bdec5ba940dc6f74143ca64a9163fff2;p=mailbox-count.git diff --git a/src/OptionalConfiguration.hs b/src/OptionalConfiguration.hs index 6bf4f9b..2d74d27 100644 --- a/src/OptionalConfiguration.hs +++ b/src/OptionalConfiguration.hs @@ -34,12 +34,13 @@ import System.IO.Error ( catchIOError ) -- data OptionalConfiguration = OptionalConfiguration { - both :: Maybe Bool, database :: Maybe String, detail :: Maybe Bool, + detail_query :: Maybe String, host :: Maybe String, password :: Maybe String, port :: Maybe Int, + summary_query :: Maybe String, username :: Maybe String } deriving (Show, Data, Typeable) @@ -72,16 +73,18 @@ instance Monoid OptionalConfiguration where Nothing Nothing Nothing + Nothing -- | Combine @cfg1@ and @cfg2@, giving precedence to @cfg2@. cfg1 `mappend` cfg2 = OptionalConfiguration - (merge_maybes (both cfg1) (both cfg2)) (merge_maybes (database cfg1) (database cfg2)) (merge_maybes (detail cfg1) (detail cfg2)) + (merge_maybes (detail_query cfg1) (detail_query cfg2)) (merge_maybes (host cfg1) (host cfg2)) (merge_maybes (password cfg1) (password cfg2)) (merge_maybes (port cfg1) (port cfg2)) + (merge_maybes (summary_query cfg1) (summary_query cfg2)) (merge_maybes (username cfg1) (username cfg2)) @@ -107,19 +110,21 @@ from_rc = do let user_config_path = home ".mailbox-countrc" cfg <- DC.load [ DC.Optional global_config_path, DC.Optional user_config_path ] - cfg_both <- DC.lookup cfg "both" cfg_database <- DC.lookup cfg "database" cfg_detail <- DC.lookup cfg "detail" + cfg_detail_query <- DC.lookup cfg "detail_query" cfg_host <- DC.lookup cfg "host" cfg_password <- DC.lookup cfg "password" cfg_port <- DC.lookup cfg "port" + cfg_summary_query <- DC.lookup cfg "summary_query" cfg_username <- DC.lookup cfg "username" return $ OptionalConfiguration - cfg_both cfg_database cfg_detail + cfg_detail_query cfg_host cfg_password cfg_port + cfg_summary_query cfg_username