diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CliOptions.hs | 28 | ||||
-rw-r--r-- | src/Lib.hs | 4 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/CliOptions.hs b/src/CliOptions.hs new file mode 100644 index 0000000..861f48e --- /dev/null +++ b/src/CliOptions.hs @@ -0,0 +1,28 @@ +module CliOptions + ( parseOptions + ) where + +import Data.Semigroup ((<>)) +import Options.Applicative + +data Options = Options + { slackApiToken :: String + } + +options :: Parser Options +options = Options + <$> strOption + ( long "slack-token" + <> metavar "TOKEN" + <> value "" + <> help "Token to access Slack's real-time messaging API" ) + +parseOptions :: IO () +parseOptions = do + execParser opts + return () + where + opts = info (options <**> helper) + ( fullDesc + <> progDesc "A chat bot with a plugin interface that does a bunch of \ + \random things." ) @@ -6,10 +6,12 @@ module Lib import Database.SQLite.Simple +import CliOptions (parseOptions) import IRC (connectIRC) import Message import Plugin someFunc :: IO () someFunc = do - connectIRC "irc.freenode.net" 6697 "test-bot-7890asdf" + -- connectIRC "irc.freenode.net" 6697 "test-bot-7890asdf" + parseOptions |