packages feed

cabal-clean 0.1.20210815 → 0.1.20210924

raw patch · 3 files changed

+21/−5 lines, 3 files

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+0.1.20210924+------------++Added one-line report on how many directories are (or could be) removed.+ 0.1.20210815 ------------ 
cabal-clean.cabal view
@@ -1,7 +1,7 @@ cabal-version:       >=1.10  name:                cabal-clean-version:             0.1.20210815+version:             0.1.20210924 synopsis:            Remove outdated cabal build artefacts from `dist-newstyle`.  description:         Simple command line tool to remove cabal build artefacts@@ -29,8 +29,9 @@   GHC == 8.4.4   GHC == 8.6.5   GHC == 8.8.4-  GHC == 8.10.4+  GHC == 8.10.7   GHC == 9.0.1+  GHC == 9.2.0.20210821  source-repository head   type:     git@@ -39,7 +40,7 @@ source-repository this   type:     git   location: git://github.com/andreasabel/cabal-clean.git-  tag:      v0.1.20210815+  tag:      v0.1.20210924  executable cabal-clean   main-is:             Main.hs
src/Main.hs view
@@ -6,6 +6,9 @@  module Main where +import Data.Monoid+  ( Sum(..) )+ import Options.Applicative   ( Parser   , action, execParser, footerDoc, headerDoc, help, helper, hidden@@ -57,9 +60,16 @@   let tree = markObsolete tree0   printBuildTree opts tree +  -- Count obsolete directories+  let nObs :: Integer+      nObs = getSum $ foldMapEntry ((\ x -> if x then Sum 1 else Sum 0) . obsolete) tree++  if nObs <= 0 then putStrLn ("Nothing to clean!")+  else if not optDelete then putStrLn $ unwords+    [ show nObs, "directories can be removed (supply option --remove)." ]   -- Remove obsolete directories-  when optDelete $ do-    chatLn opts $ unwords [ "Removing obsolete directories..." ]+  else do+    putStrLn $ unwords [ "Removing", show nObs, "obsolete directories..." ]     flip foldMapEntry tree $ \ (Entry dir obsolete) -> do       if obsolete then do         chatLn opts $ unwords [ "Removing", dir ]