mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-09-11 04:45:28 +03:00
Print message when no results are found
This commit is contained in:
parent
95fc86eaef
commit
b90cddf460
@ -11,13 +11,17 @@ import Unused.CLI.Util
|
|||||||
|
|
||||||
printSearchResults :: TermMatchSet -> IO ()
|
printSearchResults :: TermMatchSet -> IO ()
|
||||||
printSearchResults termMatchSet =
|
printSearchResults termMatchSet =
|
||||||
mapM_ (printDirectorySection columnFormat) responses
|
printFormattedResponses columnFormat responses
|
||||||
where
|
where
|
||||||
responses = responsesGroupedByPath termMatchSet
|
responses = responsesGroupedByPath termMatchSet
|
||||||
allSets = listFromMatchSet =<< map snd responses
|
allSets = listFromMatchSet =<< map snd responses
|
||||||
allResults = map snd allSets
|
allResults = map snd allSets
|
||||||
columnFormat = buildColumnFormatter allResults
|
columnFormat = buildColumnFormatter allResults
|
||||||
|
|
||||||
|
printFormattedResponses :: ColumnFormat -> [(DirectoryPrefix, TermMatchSet)] -> IO ()
|
||||||
|
printFormattedResponses _ [] = printNoResultsFound
|
||||||
|
printFormattedResponses cf r = mapM_ (printDirectorySection cf) r
|
||||||
|
|
||||||
listFromMatchSet :: TermMatchSet -> [(String, TermResults)]
|
listFromMatchSet :: TermMatchSet -> [(String, TermResults)]
|
||||||
listFromMatchSet =
|
listFromMatchSet =
|
||||||
Map.toList
|
Map.toList
|
||||||
@ -72,3 +76,10 @@ printMatches cf r ms =
|
|||||||
printNumber = cfPrintNumber cf
|
printNumber = cfPrintNumber cf
|
||||||
termColor = likelihoodColor . rLikelihood . trRemoval
|
termColor = likelihoodColor . rLikelihood . trRemoval
|
||||||
removalReason = rReason . trRemoval
|
removalReason = rReason . trRemoval
|
||||||
|
|
||||||
|
printNoResultsFound :: IO ()
|
||||||
|
printNoResultsFound = do
|
||||||
|
setSGR [SetColor Foreground Dull Green]
|
||||||
|
setSGR [SetConsoleIntensity BoldIntensity]
|
||||||
|
putStrLn "Unused found no results"
|
||||||
|
setSGR [Reset]
|
||||||
|
Loading…
Reference in New Issue
Block a user