1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 04:43:18 +03:00
juvix/app/Commands/Clean.hs
Paul Cadman 511e99f217
Use Package.juvix in the global project (#2499)
## Global package configuration

This PR updates the global-project to use `Package.juvix` instead of
`juvix.yaml`.

The global package gets the following `Package.juvix`:

```
module Package;

import PackageDescription.V1 open;

package : Package :=
  defaultPackage
    {name := "global-juvix-package";
     version := mkVersion 0 0 0;
     dependencies := [defaultStdlib]};
```

## juvix clean --global

This PR also adds an option `-g/--global` to `juvix clean` that removes
the `$XDG_CONFIG_HOME/juvix/VERSION` directory.

## Testing notes

If you've already run Juvix 0.5.3 you'll need to run `juvix clean -g`
before you'll use the new global project. This will not be an issue for
users of Juvix 0.5.4 (as this version of Juvix will never generate
juvix.yaml in the global project).

Part of:
* https://github.com/anoma/juvix/issues/2487
2023-11-06 11:49:43 +00:00

14 lines
440 B
Haskell

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