1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-27 17:43:55 +03:00
juvix/app/Commands/Clean.hs
Łukasz Czajka 923a019af1
Fix juvix clean --global (#3200)
* Closes #2992 
* Now `juvix clean --global` implies `juvix clean`. There is a new
option `--global-only` which preserves the old behaviour.
2024-11-29 16:40:39 +00:00

25 lines
674 B
Haskell

module Commands.Clean where
import Commands.Base
import Commands.Clean.Options
runCommand :: (Members '[Files, App] r) => CleanOptions -> Sem r ()
runCommand opts
| opts ^. cleanOptionsOnlyGlobal = do
cleanGlobal
| opts ^. cleanOptionsGlobal = do
cleanGlobal
cleanLocal
| otherwise = do
cleanLocal
cleanGlobal :: (Members '[Files, App] r) => Sem r ()
cleanGlobal = do
configDir <- juvixConfigDir
whenM (directoryExists' configDir) (removeDirectoryRecursive' configDir)
cleanLocal :: (Members '[Files, App] r) => Sem r ()
cleanLocal = do
buildDir <- askBuildDir
whenM (directoryExists' buildDir) (removeDirectoryRecursive' buildDir)