definition:
|
processArgs :: DocOptions -> [String] -> IO ()
processArgs opts args = do
case args of
-- no markdown
("--nomarkdown" : margs) -> processArgs opts { withMarkdown = False } margs
-- documentation type
("--title" : t : margs) -> processArgs opts { mainTitle = t } margs
("--use" : t : margs) ->
let (src,url) = break (=='@') t
in if null url
then error "URL missing in --use option!"
else processArgs opts { useDirURL = useDirURL opts ++
[(src,tail url)] } margs
("--html" : margs) -> processArgs opts { docType = HtmlDoc } margs
("--tex" : margs) ->
processArgs opts { docType = TexDoc, withIndex = False } margs
("--cdoc" : margs) ->
processArgs opts { docType = CDoc, withIndex = False } margs
-- HTML without index
["--noindexhtml",docdir,modname] -> do
opts' <- processOpts opts { withIndex = False, docType = HtmlDoc }
makeCompleteDoc opts' True docdir (stripCurrySuffix modname)
-- HTML index only
("--onlyindexhtml":docdir:modnames) -> do
opts' <- processOpts opts
makeIndexPages opts' docdir (map stripCurrySuffix modnames)
("--libsindexhtml":docdir:modnames) -> do
opts' <- processOpts opts
makeSystemLibsIndex opts' docdir modnames
(('-':_):_) -> printUsageMessage
-- module
[modname] -> do
opts' <- processOpts opts
makeCompleteDoc opts' (docType opts == HtmlDoc)
("DOC_" ++ stripCurrySuffix (takeFileName modname))
(stripCurrySuffix modname)
-- docdir + module
[docdir,modname] -> do
opts' <- processOpts opts
makeCompleteDoc opts' (docType opts == HtmlDoc) docdir
(stripCurrySuffix modname)
_ -> printUsageMessage
|