diff --git a/app/Main.hs b/app/Main.hs index 8b8db3f..952d6cd 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -62,12 +62,12 @@ parseArgs (Args t dir h v r c) = do if not (null h) then putStr $ "\n\n" ++ h ++ "\n\n" else putStr "\n" - mapM_ (mkIndex r) . filter (isSuffixOf ".gmi") =<< getDirectoryContents dir + mapM_ (mkIndex r dir) . filter (isSuffixOf ".gmi") =<< getDirectoryContents dir -mkIndex :: Bool -> FilePath -> IO () -mkIndex True l = do - line <- readFile l +mkIndex :: Bool -> FilePath -> FilePath -> IO () +mkIndex True d l = do + line <- readFile $ d++"/"++l putStrLn $ "=> " ++ l ++ " " ++ (head . lines $ line) -mkIndex False l = putStrLn $ "=> " ++ l +mkIndex False _ l = putStrLn $ "=> " ++ l --compose = (++) <$> ("=> " ++) <*> (show . length) <*> (head . lines =<< readFile)