summaryrefslogtreecommitdiff
path: root/Hsbot
diff options
context:
space:
mode:
authorJulien Dessaux2010-08-01 17:40:53 +0200
committerJulien Dessaux2010-08-01 17:40:53 +0200
commit6a7d1f0381601ee7e6b64bf41d603961d32859ac (patch)
tree53675da98fbedf0ef7f01111733a7dd699044953 /Hsbot
parentAdded the cli parser and a config file handler for hsbot-irc. (diff)
downloadhsbot-6a7d1f0381601ee7e6b64bf41d603961d32859ac.tar.gz
hsbot-6a7d1f0381601ee7e6b64bf41d603961d32859ac.tar.bz2
hsbot-6a7d1f0381601ee7e6b64bf41d603961d32859ac.zip
Added configuration debug stuff.
Diffstat (limited to '')
-rw-r--r--HsbotIrcBot/Hsbot/Irc/Config.hs14
-rw-r--r--HsbotIrcBot/Main.hs5
2 files changed, 16 insertions, 3 deletions
diff --git a/HsbotIrcBot/Hsbot/Irc/Config.hs b/HsbotIrcBot/Hsbot/Irc/Config.hs
index e0b8c64..ff14efd 100644
--- a/HsbotIrcBot/Hsbot/Irc/Config.hs
+++ b/HsbotIrcBot/Hsbot/Irc/Config.hs
@@ -22,6 +22,20 @@ data IrcConfig = IrcConfig
, ircConfigPlugins :: [String] -- the ircPlugins to load
}
+instance Show IrcConfig where
+ show (IrcConfig address port channels nickname password realname commandPrefix plugins) = unlines $
+ concat [ "Address: ", address ] :
+ concat [ "Port: ", case port of
+ PortNumber num -> show num
+ Service s -> show s
+ UnixSocket u -> show u ] :
+ concat [ "Channels: ", show channels ] :
+ concat [ "Nickname: ", nickname ] :
+ concat [ "Password: ", password ] :
+ concat [ "Realname: ", realname ] :
+ concat [ "CommandPrefix: ", show commandPrefix ] :
+ [ "Plugins: ", show plugins ]
+
-- | User configuration
ircDefaultConfig :: IrcConfig
ircDefaultConfig = IrcConfig
diff --git a/HsbotIrcBot/Main.hs b/HsbotIrcBot/Main.hs
index 070b7b6..b8fc259 100644
--- a/HsbotIrcBot/Main.hs
+++ b/HsbotIrcBot/Main.hs
@@ -22,11 +22,10 @@ main = do
hPutStrLn stderr $ concat errors ++ usageInfo header options
exitWith $ ExitFailure 1
-- From there the initialization code truly begins
- when (optDebug opts) . putStrLn $ "Got options : " ++ (show opts)
+ when (optDebug opts) . putStrLn $ "[hsbot-irc] Got CLI options :\n" ++ (show opts)
-- We find and parse the config file
ircConfig <- getIrcConfig $ optConfigFile opts
- print $ ircConfigChannels ircConfig
- print $ ircConfigPlugins ircConfig
+ when (optDebug opts) . putStrLn $ "[hsbot-irc] Compiled config :\n" ++ (show ircConfig)
-- CLI argument parting stuff {{{
-- | CLI options