mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-09-11 12:55:54 +03:00
Minor reorganization within Main.hs
This commit is contained in:
parent
6ffb098b20
commit
792d0dca05
12
app/Main.hs
12
app/Main.hs
@ -9,7 +9,7 @@ import Unused.TermSearch (SearchResults(..), fromResults)
|
||||
import Unused.ResultsClassifier
|
||||
import Unused.ResponseFilter (withOneOccurrence, withLikelihoods, ignoringPaths)
|
||||
import Unused.Grouping (CurrentGrouping(..), groupedResponses)
|
||||
import Unused.CLI (SearchRunner(..), withoutCursor, renderHeader, executeSearch, resetScreen, withInterruptHandler)
|
||||
import Unused.CLI (SearchRunner(..), withoutCursor, renderHeader, executeSearch, withInterruptHandler)
|
||||
import qualified Unused.CLI.Views as V
|
||||
import Unused.Cache
|
||||
import Unused.Aliases (termsAndAliases)
|
||||
@ -27,7 +27,7 @@ data Options = Options
|
||||
}
|
||||
|
||||
main :: IO ()
|
||||
main = withInterruptHandler $
|
||||
main = withInterruptHandler $ withoutCursor $
|
||||
run =<< execParser
|
||||
(withInfo parseOptions pHeader pDescription pFooter)
|
||||
where
|
||||
@ -38,7 +38,7 @@ main = withInterruptHandler $
|
||||
pFooter = "CLI USAGE: $ unused"
|
||||
|
||||
run :: Options -> IO ()
|
||||
run options = withoutCursor $ do
|
||||
run options = do
|
||||
hSetBuffering stdout NoBuffering
|
||||
|
||||
terms' <- calculateTagInput options
|
||||
@ -53,11 +53,7 @@ run options = withoutCursor $ do
|
||||
renderHeader terms
|
||||
results <- withCache options $ executeSearch (oSearchRunner options) terms
|
||||
|
||||
let response = parseResults languageConfig results
|
||||
|
||||
resetScreen
|
||||
|
||||
printResults options response
|
||||
printResults options $ parseResults languageConfig results
|
||||
|
||||
return ()
|
||||
|
||||
|
@ -16,7 +16,8 @@ import qualified Unused.CLI.Views.NoResultsFound as V
|
||||
type ResultsPrinter = ReaderT ColumnFormat IO
|
||||
|
||||
searchResults :: [GroupedTerms] -> IO ()
|
||||
searchResults terms =
|
||||
searchResults terms = do
|
||||
resetScreen
|
||||
runReaderT (printFormattedTerms terms) columnFormat
|
||||
where
|
||||
columnFormat = buildColumnFormatter $ termsToResults terms
|
||||
|
Loading…
Reference in New Issue
Block a user