diff --git a/cli-example/Main.hs b/cli-example/Main.hs index 99cc0d0..56695f8 100644 --- a/cli-example/Main.hs +++ b/cli-example/Main.hs @@ -3,17 +3,22 @@ import System.Environment (getArgs) import System.Exit (exitFailure) import Control.Monad (when) -import MDict (lookupInCollection) +import MDict main :: IO () main = do - args <- getArgs - when (length args < 2) $ do - putStrLn "Usage: Main " - exitFailure + args <- getArgs + when (length args < 2) $ do + putStrLn "Usage: Main " + exitFailure - let dictDir = args !! 0 - queryKey = args !! 1 + let dict = args !! 0 + queryKey = args !! 1 - -- Process all files - lookupInCollection dictDir queryKey + res <- processDictionary dict queryKey + html <- case res of + Left err -> error err + Right h -> return h + + + putStrLn (html)