diff --git a/CHANGELOG_NEXT.md b/CHANGELOG_NEXT.md index 3fc66af1b..0da60d93b 100644 --- a/CHANGELOG_NEXT.md +++ b/CHANGELOG_NEXT.md @@ -256,4 +256,5 @@ This CHANGELOG describes the merged but unreleased changes. Please see [CHANGELO #### Documentation -* Module docstrings are now displayed for namespace indexes when documentation is built via --mkdoc. +* Module docstrings are now displayed for namespace indexes when documentation is built via `--mkdoc`. +* Generated documentation are now removed via `--clean`. diff --git a/src/Idris/Package.idr b/src/Idris/Package.idr index 3862d795f..3eb13a955 100644 --- a/src/Idris/Package.idr +++ b/src/Idris/Package.idr @@ -843,6 +843,10 @@ clean pkg opts -- `opts` is not used but might be in the future deleteFolder builddir [] maybe (pure ()) (\e => delete (outputdir </> e)) (executable pkg) + -- clean out the generated docs + let build = build_dir (dirs (options defs)) + deleteDocsFolder $ build </> "docs" </> "docs" + deleteDocsFolder $ build </> "docs" runScript (postclean pkg) where delete : String -> Core () @@ -859,6 +863,14 @@ clean pkg opts -- `opts` is not used but might be in the future delete $ ttFile <.> "ttc" delete $ ttFile <.> "ttm" + deleteDocsFolder : String -> Core () + deleteDocsFolder dir + = do Right docbasefiles <- coreLift $ listDir dir + | Left err => pure () + traverse_ (\x => delete $ dir </> x) + docbasefiles + deleteFolder dir [] + -- Just load the given module, if it exists, which will involve building -- it if necessary runRepl : {auto c : Ref Ctxt Defs} ->