1. Konstantine Rybnikov
  2. duplicates

Commits

Konstantine Rybnikov  committed 9915322

Display only useful info.

  • Participants
  • Parent commits c028da8
  • Branches default

Comments (0)

Files changed (2)

File Duplicates/Duplicates.hs

View file
  • Ignore whitespace
   printIndex,
   showSummary,
   compareSummaries,
+  isEmptySummary,
 
   NodeInfo(..),
   NodePath(..),
   (compare 
    (unDuplicatesSize (getDuplicatesSize s1))
    (unDuplicatesSize (getDuplicatesSize s2)))
+
+isEmptySummary :: DuplicateSummary -> Bool
+isEmptySummary s = (unDuplicatesCount (getDuplicatesCount s)) == 0

File duplicates.hs

View file
  • Ignore whitespace
 
 import Duplicates.Utils      ( safeHead, allPossibleDirs )
 import Duplicates.Duplicates ( showSummary, indexPath, getDuplicatesSummary )
-import Duplicates.Duplicates ( printIndex, compareSummaries )
+import Duplicates.Duplicates ( printIndex, compareSummaries, isEmptySummary )
 
 getPathFromArgs :: [String] -> Maybe String
 getPathFromArgs args = safeHead args
           let dirsWithSummary = zip dirs dirSummaries
           let sortedDirsWithSummary =
                 sortBy (\(d1, s1) (d2, s2) -> (compareSummaries s1 s2)) dirsWithSummary
+          let filteredDirsWithSummary =
+                filter (\(d, s) -> not (isEmptySummary s)) sortedDirsWithSummary
           let showDirWithSummary (dir, summary) = dir ++ ": " ++ (showSummary summary)
-          let stats = map showDirWithSummary sortedDirsWithSummary
+          let stats = map showDirWithSummary filteredDirsWithSummary
           putStrLn "Duplicate stats:"
           putStrLn $ intercalate "\n" $ map ("> " ++) $ stats
           return ()