forked from hashirama/mdict-hs
the processDictionary function is the one we need to use for lookups, because it inserts all resources and gives just the full html at the end, ready to be displayed Signed-off-by: hashirama <hashirama@noreply.localhost>
24 lines
477 B
Haskell
24 lines
477 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
import System.Environment (getArgs)
|
|
import System.Exit (exitFailure)
|
|
import Control.Monad (when)
|
|
import MDict
|
|
|
|
main :: IO ()
|
|
main = do
|
|
args <- getArgs
|
|
when (length args < 2) $ do
|
|
putStrLn "Usage: Main <dictionary_dir> <query_key>"
|
|
exitFailure
|
|
|
|
let dict = args !! 0
|
|
queryKey = args !! 1
|
|
|
|
res <- processDictionary dict queryKey
|
|
html <- case res of
|
|
Left err -> error err
|
|
Right h -> return h
|
|
|
|
|
|
putStrLn (html)
|