From 00017304978ebed385c26a1e1efafb8ec5a00748 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Mon, 31 Jul 2023 02:30:56 +0200 Subject: [PATCH] Support for not using it in CGI context --- app/Main.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Main.hs b/app/Main.hs index 7af805b..8944836 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -12,6 +12,7 @@ data Args = Args , directory :: FilePath , fileHead :: FilePath , verbose :: Bool + , cgi :: Bool } args :: Parser Args @@ -35,6 +36,9 @@ args = Args ( long "verbose" <> short 'v' <> help "Verbose mode") + <*> switch + ( long "cgi" + <> help "Output gemini file header") main :: IO () main = parseArgs =<< execParser opts @@ -45,7 +49,11 @@ main = parseArgs =<< execParser opts <> header "Generate a gemini page index") parseArgs :: Args -> IO() -parseArgs (Args t d h False) = do +parseArgs (Args t d h False False) = do + putStrLn $ "# " ++ t + putStrLn h + mkIndex =<< getDirectoryContents d +parseArgs (Args t d h False True) = do putStr success putStrLn $ "# " ++ t putStrLn h