Helps to pay attention sometimes

This commit is contained in:
Nox Sluijtman 2023-07-31 15:09:44 +02:00
parent 48a785ff97
commit e83fd886d0

View file

@ -39,6 +39,7 @@ args = Args
<> help "Verbose mode") <> help "Verbose mode")
<*> switch <*> switch
( long "references" ( long "references"
<> short 'R'
<> help "Generate link reference based on first line of document" ) <> help "Generate link reference based on first line of document" )
<*> switch <*> switch
( long "cgi" ( long "cgi"
@ -53,7 +54,7 @@ main = parseArgs =<< execParser opts
<> header "Generate a gemini page index") <> header "Generate a gemini page index")
parseArgs :: Args -> IO() parseArgs :: Args -> IO()
parseArgs (Args t dir h v c r) = do parseArgs (Args t dir h v r c) = do
if c then do if c then do
putStr success putStr success
putStrLn $ "# " ++ t putStrLn $ "# " ++ t
@ -66,7 +67,7 @@ parseArgs (Args t dir h v c r) = do
mkIndex :: Bool -> FilePath -> IO () mkIndex :: Bool -> FilePath -> IO ()
mkIndex True l = do mkIndex True l = do
line <- readFile l line <- readFile 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)