diff --git a/app/Main.hs b/app/Main.hs index d0140c9..7af805b 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,10 +1,12 @@ module Main where import System.Directory -import System.Environment import Options.Applicative import Data.List +success :: String +success = "20 text/gemini; lang=en; charset=utf-8\r\n" + data Args = Args { title :: String , directory :: FilePath @@ -28,29 +30,27 @@ args = Args ( long "header" <> short 'H' <> value "" - <> help "File with header text" ) + <> help "Header text" ) <*> switch ( long "verbose" <> short 'v' <> help "Verbose mode") - - --mapM_ putStrLn =<< getDirectoryContents =<< getEnv "FIETS" main :: IO () main = parseArgs =<< execParser opts where opts = info ( args <**> helper) ( fullDesc - <> progDesc "Generate gemini page index" - <> header "fucking kill me") + <> progDesc "Generate gemini page index" + <> header "Generate a gemini page index") parseArgs :: Args -> IO() parseArgs (Args t d h False) = do + putStr success putStrLn $ "# " ++ t - putStrLn =<< readFile h + putStrLn h mkIndex =<< getDirectoryContents d parseArgs _ = putStrLn "fiets" mkIndex :: [String] -> IO () ---mkIndex = mapM_ (putStrLn . ("=> " ++)) mkIndex = mapM_ (putStrLn . ("=> " ++)) . filter (isSuffixOf ".gmi")