Konstantine Rybnikov avatar Konstantine Rybnikov committed 9915322

Display only useful info.

Comments (0)

Files changed (2)

Duplicates/Duplicates.hs

   printIndex,
   showSummary,
   compareSummaries,
+  isEmptySummary,
 
   NodeInfo(..),
   NodePath(..),
   (compare 
    (unDuplicatesSize (getDuplicatesSize s1))
    (unDuplicatesSize (getDuplicatesSize s2)))
+
+isEmptySummary :: DuplicateSummary -> Bool
+isEmptySummary s = (unDuplicatesCount (getDuplicatesCount s)) == 0
 
 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 ()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.