mirror of
https://github.com/anoma/juvix.git
synced 2024-12-27 17:43:55 +03:00
923a019af1
* Closes #2992 * Now `juvix clean --global` implies `juvix clean`. There is a new option `--global-only` which preserves the old behaviour.
25 lines
674 B
Haskell
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)
|