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
|
||||
, 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
|
||||
|
|
Loading…
Reference in a new issue