Auxiliary function refactor.

This commit is contained in:
Matthew-Mosior 2024-07-27 18:32:59 -04:00
parent 5a19a888a0
commit ccff608e19

View File

@ -845,18 +845,8 @@ clean pkg opts -- `opts` is not used but might be in the future
(executable pkg) (executable pkg)
-- clean out the generated docs -- clean out the generated docs
let build = build_dir (dirs (options defs)) let build = build_dir (dirs (options defs))
let docBase = build </> "docs" () <- deleteDocDirFolder build
let docDir = docBase </> "docs" () <- deleteDocBaseFolder build
() <- do Right docfiles' <- coreLift $ listDir docDir
| Left err => pure ()
traverse_ (\x => delete $ docDir </> x)
docfiles'
deleteFolder docDir []
() <- do Right docfiles'' <- coreLift $ listDir docBase
| Left err => pure ()
traverse_ (\x => delete $ docBase </> x)
docfiles''
deleteFolder docBase []
runScript (postclean pkg) runScript (postclean pkg)
where where
delete : String -> Core () delete : String -> Core ()
@ -873,6 +863,24 @@ clean pkg opts -- `opts` is not used but might be in the future
delete $ ttFile <.> "ttc" delete $ ttFile <.> "ttc"
delete $ ttFile <.> "ttm" delete $ ttFile <.> "ttm"
deleteDocBaseFolder : String -> Core ()
deleteDocBaseFolder build
= do let docBase = build </> "docs"
Right docbasefiles <- coreLift $ listDir docBase
| Left err => pure ()
traverse_ (\x => delete $ docBase </> x)
docbasefiles
deleteFolder docBase []
deleteDocDirFolder : String -> Core ()
deleteDocDirFolder build
= do let docDir = build </> "docs" </> "docs"
Right docdirfiles <- coreLift $ listDir docDir
| Left err => pure ()
traverse_ (\x => delete $ docDir </> x)
docdirfiles
deleteFolder docDir []
-- Just load the given module, if it exists, which will involve building -- Just load the given module, if it exists, which will involve building
-- it if necessary -- it if necessary
runRepl : {auto c : Ref Ctxt Defs} -> runRepl : {auto c : Ref Ctxt Defs} ->