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.Types (ParseResponse, RemovalLikelihood(..))
|
||||||
import Unused.ResponseFilter (withOneOccurrence, withLikelihoods, ignoringPaths)
|
import Unused.ResponseFilter (withOneOccurrence, withLikelihoods, ignoringPaths)
|
||||||
import Unused.Grouping (CurrentGrouping(..), groupedResponses)
|
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
|
data Options = Options
|
||||||
{ oSearchRunner :: SearchRunner
|
{ oSearchRunner :: SearchRunner
|
||||||
@ -35,7 +35,10 @@ run options = do
|
|||||||
hSetBuffering stdout NoBuffering
|
hSetBuffering stdout NoBuffering
|
||||||
|
|
||||||
terms <- pure . lines =<< getContents
|
terms <- pure . lines =<< getContents
|
||||||
|
renderHeader terms
|
||||||
|
|
||||||
results <- unlines <$> executeSearch (oSearchRunner options) terms
|
results <- unlines <$> executeSearch (oSearchRunner options) terms
|
||||||
|
|
||||||
let response = parseLines results
|
let response = parseLines results
|
||||||
|
|
||||||
resetScreen
|
resetScreen
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
module Unused.CLI.Search
|
module Unused.CLI.Search
|
||||||
( SearchRunner(..)
|
( SearchRunner(..)
|
||||||
|
, renderHeader
|
||||||
, executeSearch
|
, executeSearch
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@ -9,11 +10,15 @@ import Unused.CLI.ProgressIndicator
|
|||||||
|
|
||||||
data SearchRunner = SearchWithProgress | SearchWithoutProgress
|
data SearchRunner = SearchWithProgress | SearchWithoutProgress
|
||||||
|
|
||||||
executeSearch :: SearchRunner -> [String] -> IO [String]
|
renderHeader :: [String] -> IO ()
|
||||||
executeSearch runner terms = do
|
renderHeader terms = do
|
||||||
resetScreen
|
resetScreen
|
||||||
hideCursor
|
hideCursor
|
||||||
printAnalysisHeader terms
|
printAnalysisHeader terms
|
||||||
|
|
||||||
|
executeSearch :: SearchRunner -> [String] -> IO [String]
|
||||||
|
executeSearch runner terms = do
|
||||||
|
renderHeader terms
|
||||||
runSearch runner terms <* resetScreen <* showCursor
|
runSearch runner terms <* resetScreen <* showCursor
|
||||||
|
|
||||||
printAnalysisHeader :: [String] -> IO ()
|
printAnalysisHeader :: [String] -> IO ()
|
||||||
|
Loading…
Reference in New Issue
Block a user