First attempt at implementation

This commit is contained in:
Nox Sluijtman 2023-07-31 14:57:33 +02:00
parent 5d241e19f8
commit 48a785ff97

View file

@ -61,16 +61,12 @@ parseArgs (Args t dir h v c r) = 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"
mkIndex r . filter (isSuffixOf ".gmi") =<< getDirectoryContents dir mapM_ (mkIndex r) . filter (isSuffixOf ".gmi") =<< getDirectoryContents dir
mkIndex :: Bool -> [String] -> IO () mkIndex :: Bool -> FilePath -> IO ()
mkIndex True l = mapM_ (putStrLn . ("=> " ++)) l mkIndex True l = do
-- where firstLine f = do line <- readFile l
-- print $ head . lines =<< readFile f putStrLn $ "=> " ++ l ++ (head . lines $ line)
mkIndex False l = mapM_ (putStrLn . ("=> " ++)) l mkIndex False l = putStrLn $ "=> " ++ l
firstLine :: FilePath -> IO ()
firstLine f = do
putStr . head . lines =<< readFile f
--compose = (++) <$> ("=> " ++) <*> (show . length) <*> (head . lines =<< readFile) --compose = (++) <$> ("=> " ++) <*> (show . length) <*> (head . lines =<< readFile)