Added configuration debug stuff.
This commit is contained in:
parent
6888950b60
commit
6a7d1f0381
2 changed files with 16 additions and 3 deletions
|
@ -22,6 +22,20 @@ data IrcConfig = IrcConfig
|
||||||
, ircConfigPlugins :: [String] -- the ircPlugins to load
|
, 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
|
-- | User configuration
|
||||||
ircDefaultConfig :: IrcConfig
|
ircDefaultConfig :: IrcConfig
|
||||||
ircDefaultConfig = IrcConfig
|
ircDefaultConfig = IrcConfig
|
||||||
|
|
|
@ -22,11 +22,10 @@ main = do
|
||||||
hPutStrLn stderr $ concat errors ++ usageInfo header options
|
hPutStrLn stderr $ concat errors ++ usageInfo header options
|
||||||
exitWith $ ExitFailure 1
|
exitWith $ ExitFailure 1
|
||||||
-- From there the initialization code truly begins
|
-- 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
|
-- We find and parse the config file
|
||||||
ircConfig <- getIrcConfig $ optConfigFile opts
|
ircConfig <- getIrcConfig $ optConfigFile opts
|
||||||
print $ ircConfigChannels ircConfig
|
when (optDebug opts) . putStrLn $ "[hsbot-irc] Compiled config :\n" ++ (show ircConfig)
|
||||||
print $ ircConfigPlugins ircConfig
|
|
||||||
|
|
||||||
-- CLI argument parting stuff {{{
|
-- CLI argument parting stuff {{{
|
||||||
-- | CLI options
|
-- | CLI options
|
||||||
|
|
Reference in a new issue