mdict-hs/cli-example/Main.hs
hashirama 5b67ca2164 use the target function
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>
2026-01-20 03:24:16 +00:00

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)