X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FConfiguration.hs;h=478d465ef8aefe5eb1225d60505b23bdffedeab8;hp=4898c08978e6d71846c85c535c39c64b4642edd9;hb=fc0052e451aa03675ebd9a128dfa46573b9357d7;hpb=aad40cd8e1e8c84c5fc294674a7159bb40838440 diff --git a/src/Configuration.hs b/src/Configuration.hs index 4898c08..478d465 100644 --- a/src/Configuration.hs +++ b/src/Configuration.hs @@ -28,37 +28,43 @@ import ExitCodes -- | Contains all of our configurable options. data Cfg = Cfg { - article :: String, - output :: FilePath, - password :: Maybe String, - username :: Maybe String } + article :: String, + cookie_jar :: Maybe FilePath, + output :: FilePath, + password :: Maybe String, + username :: Maybe String } instance Monoid Cfg where mempty = Cfg { article = "", + cookie_jar = Nothing, output = "", password = Nothing, username = Nothing } mappend c1 c2 = - let article' = (if null article1 then article2 else article1) - output' = (if null output1 then output2 else output1) - password' = password1 `mplus` password2 - username' = username1 `mplus` username2 + let article' = (if null article1 then article2 else article1) + cookie_jar' = cookie_jar1 `mplus` cookie_jar2 + output' = (if null output1 then output2 else output1) + password' = password1 `mplus` password2 + username' = username1 `mplus` username2 in - Cfg { article = article', - output = output', - password = password', - username = username' } + Cfg { article = article', + cookie_jar = cookie_jar', + output = output', + password = password', + username = username' } where - article1 = article c1 - article2 = article c2 - output1 = output c1 - output2 = output c2 - password1 = password c1 - password2 = password c2 - username1 = username c1 - username2 = username c2 + article1 = article c1 + article2 = article c2 + cookie_jar1 = cookie_jar c1 + cookie_jar2 = cookie_jar c2 + output1 = output c1 + output2 = output c2 + password1 = password c1 + password2 = password c2 + username1 = username c1 + username2 = username c2 use_account :: Cfg -> Bool