Created
June 6, 2009 07:39
-
-
Save simonmichael/124760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- help :: IO () | |
help = do | |
putStrLn "rss2irc [--links] <server> <port> <channel> <nick> <feed-url> <msg-prefix> <interval>" | |
exitWith ExitSuccess | |
main :: IO () | |
main = do | |
(flags, args, errs) <- getOpt Permute [Option ['l'] ["links"] (NoArg Links) "include link URLs"] `fmap` getArgs | |
when (not . null $ errs) help | |
let l = Links `elem` flags | |
(st, feed, prefix, interval) <- case args of | |
[s,p,c,n,f,z,i] | Just intp <- maybeRead p, Just inti <- maybeRead i -> | |
return (Bot { socket = stdout | |
, server = s | |
, port = intp | |
, channel = c | |
, nick = n | |
, links = l } | |
,f, z, inti) | |
_ -> help |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment