Path parsing

This commit is contained in:
Nox Sluijtman 2023-07-31 15:14:59 +02:00
parent e83fd886d0
commit 137b150cc3

View file

@ -62,12 +62,12 @@ parseArgs (Args t dir h v r c) = do
if not (null h) if not (null h)
then putStr $ "\n\n" ++ h ++ "\n\n" then putStr $ "\n\n" ++ h ++ "\n\n"
else putStr "\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 :: Bool -> FilePath -> FilePath -> IO ()
mkIndex True l = do mkIndex True d l = do
line <- readFile l line <- readFile $ d++"/"++l
putStrLn $ "=> " ++ l ++ " " ++ (head . lines $ line) putStrLn $ "=> " ++ l ++ " " ++ (head . lines $ line)
mkIndex False l = putStrLn $ "=> " ++ l mkIndex False _ l = putStrLn $ "=> " ++ l
--compose = (++) <$> ("=> " ++) <*> (show . length) <*> (head . lines =<< readFile) --compose = (++) <$> ("=> " ++) <*> (show . length) <*> (head . lines =<< readFile)