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>
This commit is contained in:
parent
7b64430472
commit
5b67ca2164
1 changed files with 14 additions and 9 deletions
|
|
@ -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 <dictionary_dir> <query_key>"
|
||||
exitFailure
|
||||
args <- getArgs
|
||||
when (length args < 2) $ do
|
||||
putStrLn "Usage: Main <dictionary_dir> <query_key>"
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue