Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghcup-hs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
ghcup-hs
Commits
8a1dbe9d
Commit
8a1dbe9d
authored
4 years ago
by
Arjun Kathuria
Browse files
Options
Downloads
Patches
Plain Diff
basic implementation of rmGhcupDirs function that removes relevant dirs in NUKE command
parent
4ef36226
No related branches found
No related tags found
1 merge request
!101
[WIP] Feature "nuke"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/GHCup.hs
+60
-0
60 additions, 0 deletions
lib/GHCup.hs
with
60 additions
and
0 deletions
lib/GHCup.hs
+
60
−
0
View file @
8a1dbe9d
...
...
@@ -1311,6 +1311,66 @@ rmTool ListResult {lVer, lTool, lCross} = do
-- leaving this unimplemented for now.
pure
()
rmGhcupDirs
::
(
MonadReader
AppState
m
,
MonadIO
m
,
MonadLogger
m
)
=>
m
()
rmGhcupDirs
=
do
dirs
@
Dirs
{
baseDir
,
binDir
,
logsDir
,
cacheDir
,
confDir
}
<-
asks
dirs
let
envDir
=
baseDir
</>
"env"
-- remove env Dir
rmEnvDir
envDir
-- remove entire cache Dir
rmCacheDir
cacheDir
-- remove entire logs Dir
rmLogsDir
logsDir
-- remove the $ghcupConfigDir/config.yaml file
rmConfFile
confDir
liftIO
$
print
dirs
where
rmEnvDir
envDir
=
do
isEnvDirPresent
<-
liftIO
$
doesDirectoryExist
envDir
if
isEnvDirPresent
then
do
$
logInfo
"Removing Ghcup Environment Dir"
liftIO
$
removeDirectory
envDir
else
$
logInfo
"EnvDir Not Found, Skipping"
rmCacheDir
cacheDir
=
do
$
logInfo
"removing ghcup cache Dir"
liftIO
$
removeDirectory
cacheDir
rmLogsDir
logsDir
=
do
$
logInfo
"removing ghcup logs Dir"
liftIO
$
removeDirectory
logsDir
rmConfFile
confDir
=
do
let
confPath
=
confDir
</>
"config.yaml"
exists
<-
liftIO
$
doesFileExist
confPath
if
exists
then
do
$
logInfo
"removing config.yaml"
liftIO
$
removeFile
confPath
else
$
logInfo
"no config file found, skipping."
------------------
--[ Debug info ]--
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment