0 | module Pack.Runner.Uninstall
 1 |
 2 | import Pack.Config.Environment
 3 | import Pack.Config.Types
 4 | import Pack.Core.IO
 5 | import Pack.Core.Logging
 6 | import Pack.Core.Types
 7 |
 8 | %default total
 9 |
10 | --------------------------------------------------------------------------------
11 | --          Uninstalling Pack
12 | --------------------------------------------------------------------------------
13 |
14 | export covering
15 | uninstallPack :
16 |      {auto _  : LogRef}
17 |   -> {auto pd : PackDirs}
18 |   -> {auto _  : HasIO io}
19 |   -> EitherT PackErr io ()
20 | uninstallPack = do
21 |   info "Uninstalling pack"
22 |   let msg :=
23 |     """
24 |     This command will remove pack together with the Idris2 compiler
25 |     managed by pack and all installed libraries. You might need
26 |     to manually remove some of the executables managed by pack
27 |     located in `\{pd.bin}`.
28 |
29 |     Please note that your personal settings at `\{userDir}` will not
30 |     be removed.
31 |     """
32 |   confirmOrAbort Info msg
33 |   rmDir pd.state
34 |   rmDir pd.cache
35 |   rmFile packExec
36 |   rmFile (pathExec "idris2")
37 |   rmFile (pathExec "idris2-lsp")
38 |