diff --git a/app/Main.hs b/app/Main.hs index d51185d..a00ab2b 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -3,6 +3,7 @@ module Main where import Options.Applicative import System.IO (hSetBuffering, BufferMode(NoBuffering), stdout) import Unused.Parser (parseLines) +import Unused.Types (ParseResponse) import Unused.ResponseFilter (withOneOccurrence, withOneFile) import Unused.CLI (SearchRunner(..), executeSearch, printParseError, printSearchResults, resetScreen) @@ -25,13 +26,21 @@ run options = do resetScreen either printParseError printSearchResults $ - withOneOccurrence $ withOneFile response + optionFilters options response return () withInfo :: Parser a -> String -> ParserInfo a withInfo opts desc = info (helper <*> opts) $ progDesc desc +optionFilters :: Options -> (ParseResponse -> ParseResponse) +optionFilters _ = + foldl1 (.) filters + where + filters = + [ withOneOccurrence . withOneFile + ] + parseOptions :: Parser Options parseOptions = Options