Support for not using it in CGI context
This commit is contained in:
parent
aec4e53e5d
commit
0001730497
10
app/Main.hs
10
app/Main.hs
|
@ -12,6 +12,7 @@ data Args = Args
|
||||||
, directory :: FilePath
|
, directory :: FilePath
|
||||||
, fileHead :: FilePath
|
, fileHead :: FilePath
|
||||||
, verbose :: Bool
|
, verbose :: Bool
|
||||||
|
, cgi :: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
args :: Parser Args
|
args :: Parser Args
|
||||||
|
@ -35,6 +36,9 @@ args = Args
|
||||||
( long "verbose"
|
( long "verbose"
|
||||||
<> short 'v'
|
<> short 'v'
|
||||||
<> help "Verbose mode")
|
<> help "Verbose mode")
|
||||||
|
<*> switch
|
||||||
|
( long "cgi"
|
||||||
|
<> help "Output gemini file header")
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = parseArgs =<< execParser opts
|
main = parseArgs =<< execParser opts
|
||||||
|
@ -45,7 +49,11 @@ 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 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
|
putStr success
|
||||||
putStrLn $ "# " ++ t
|
putStrLn $ "# " ++ t
|
||||||
putStrLn h
|
putStrLn h
|
||||||
|
|
Loading…
Reference in a new issue