Skip to content

Instantly share code, notes, and snippets.

@dcoutts
Created June 1, 2018 21:58
Show Gist options
  • Save dcoutts/98ed3665519390adbf9fad2a9523580d to your computer and use it in GitHub Desktop.
Save dcoutts/98ed3665519390adbf9fad2a9523580d to your computer and use it in GitHub Desktop.
cleanAction :: CleanFlags -> [String] -> GlobalFlags -> IO ()
cleanAction cleanFlags extraArgs globalFlags = do
projectRootDir <- findProjectRoot
let DistDirLayout{distDirectory} = defaultDistDirLayout projectRootDir
notice verbosity "cleaning..."
-- Remove the whole shared dist dir
chattyTry "removing dist/" $ do
exists <- doesDirectoryExist distDirectory
when exists (removeDirectoryRecursive distDirectory)
-- Any extra files the user wants to remove
mapM_ removeFileOrDirectory (extraTmpFiles pkg_descr)
unless saveConfig $ do
-- Delete the cabal.project.local too
where
verbosity = fromFlagOrDefault normal (cleanVerbosity cleanFlags)
saveConfig = fromFlagOrDefault False (cleanSaveConf cleanFlags)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment