mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-09-11 04:45:28 +03:00
Render base header as soon as we have tokens
This commit is contained in:
parent
e70a7e4e0b
commit
790b62c999
@ -7,7 +7,7 @@ import Unused.Parser (parseLines)
|
||||
import Unused.Types (ParseResponse, RemovalLikelihood(..))
|
||||
import Unused.ResponseFilter (withOneOccurrence, withLikelihoods, ignoringPaths)
|
||||
import Unused.Grouping (CurrentGrouping(..), groupedResponses)
|
||||
import Unused.CLI (SearchRunner(..), executeSearch, printParseError, printSearchResults, resetScreen, withInterruptHandler)
|
||||
import Unused.CLI (SearchRunner(..), renderHeader, executeSearch, printParseError, printSearchResults, resetScreen, withInterruptHandler)
|
||||
|
||||
data Options = Options
|
||||
{ oSearchRunner :: SearchRunner
|
||||
@ -35,7 +35,10 @@ run options = do
|
||||
hSetBuffering stdout NoBuffering
|
||||
|
||||
terms <- pure . lines =<< getContents
|
||||
renderHeader terms
|
||||
|
||||
results <- unlines <$> executeSearch (oSearchRunner options) terms
|
||||
|
||||
let response = parseLines results
|
||||
|
||||
resetScreen
|
||||
|
@ -1,5 +1,6 @@
|
||||
module Unused.CLI.Search
|
||||
( SearchRunner(..)
|
||||
, renderHeader
|
||||
, executeSearch
|
||||
) where
|
||||
|
||||
@ -9,11 +10,15 @@ import Unused.CLI.ProgressIndicator
|
||||
|
||||
data SearchRunner = SearchWithProgress | SearchWithoutProgress
|
||||
|
||||
executeSearch :: SearchRunner -> [String] -> IO [String]
|
||||
executeSearch runner terms = do
|
||||
renderHeader :: [String] -> IO ()
|
||||
renderHeader terms = do
|
||||
resetScreen
|
||||
hideCursor
|
||||
printAnalysisHeader terms
|
||||
|
||||
executeSearch :: SearchRunner -> [String] -> IO [String]
|
||||
executeSearch runner terms = do
|
||||
renderHeader terms
|
||||
runSearch runner terms <* resetScreen <* showCursor
|
||||
|
||||
printAnalysisHeader :: [String] -> IO ()
|
||||
|
Loading…
Reference in New Issue
Block a user