mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-09-11 04:45:28 +03:00
Extract error headers
This commit is contained in:
parent
b65de02efc
commit
1892f8c0ba
15
src/Unused/CLI/Views/Error.hs
Normal file
15
src/Unused/CLI/Views/Error.hs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module Unused.CLI.Views.Error
|
||||||
|
( errorHeader
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Unused.CLI.Util
|
||||||
|
|
||||||
|
errorHeader :: String -> IO ()
|
||||||
|
errorHeader s = do
|
||||||
|
setSGR [SetColor Background Vivid Red]
|
||||||
|
setSGR [SetColor Foreground Vivid White]
|
||||||
|
setSGR [SetConsoleIntensity BoldIntensity]
|
||||||
|
|
||||||
|
putStrLn $ "\n" ++ s ++ "\n"
|
||||||
|
|
||||||
|
setSGR [Reset]
|
@ -3,17 +3,12 @@ module Unused.CLI.Views.InvalidConfigError
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Unused.CLI.Util
|
import Unused.CLI.Util
|
||||||
|
import Unused.CLI.Views.Error
|
||||||
import Unused.ResultsClassifier (ParseConfigError(..))
|
import Unused.ResultsClassifier (ParseConfigError(..))
|
||||||
|
|
||||||
invalidConfigError :: [ParseConfigError] -> IO ()
|
invalidConfigError :: [ParseConfigError] -> IO ()
|
||||||
invalidConfigError es = do
|
invalidConfigError es = do
|
||||||
setSGR [SetColor Background Vivid Red]
|
errorHeader "There was a problem with the following config file(s):"
|
||||||
setSGR [SetColor Foreground Vivid White]
|
|
||||||
setSGR [SetConsoleIntensity BoldIntensity]
|
|
||||||
|
|
||||||
putStrLn "\nThere was a problem with the following config file(s):\n"
|
|
||||||
|
|
||||||
setSGR [Reset]
|
|
||||||
|
|
||||||
mapM_ configError es
|
mapM_ configError es
|
||||||
|
|
||||||
|
@ -4,18 +4,13 @@ module Unused.CLI.Views.MissingTagsFileError
|
|||||||
|
|
||||||
import Unused.TagsSource
|
import Unused.TagsSource
|
||||||
import Unused.CLI.Util
|
import Unused.CLI.Util
|
||||||
|
import Unused.CLI.Views.Error
|
||||||
|
|
||||||
missingTagsFileError :: TagSearchOutcome -> IO ()
|
missingTagsFileError :: TagSearchOutcome -> IO ()
|
||||||
missingTagsFileError e = do
|
missingTagsFileError e = do
|
||||||
setSGR [SetColor Background Vivid Red]
|
errorHeader "There was a problem finding a tags file."
|
||||||
setSGR [SetColor Foreground Vivid White]
|
|
||||||
setSGR [SetConsoleIntensity BoldIntensity]
|
|
||||||
|
|
||||||
putStrLn "\nThere was a problem finding a tags file.\n"
|
|
||||||
|
|
||||||
setSGR [Reset]
|
|
||||||
|
|
||||||
printOutcomeMessage e
|
printOutcomeMessage e
|
||||||
|
|
||||||
putStr "\n"
|
putStr "\n"
|
||||||
|
|
||||||
setSGR [SetConsoleIntensity BoldIntensity]
|
setSGR [SetConsoleIntensity BoldIntensity]
|
||||||
|
@ -42,6 +42,7 @@ library
|
|||||||
, Unused.CLI.GitContext
|
, Unused.CLI.GitContext
|
||||||
, Unused.CLI.Util
|
, Unused.CLI.Util
|
||||||
, Unused.CLI.Views
|
, Unused.CLI.Views
|
||||||
|
, Unused.CLI.Views.Error
|
||||||
, Unused.CLI.Views.NoResultsFound
|
, Unused.CLI.Views.NoResultsFound
|
||||||
, Unused.CLI.Views.AnalysisHeader
|
, Unused.CLI.Views.AnalysisHeader
|
||||||
, Unused.CLI.Views.GitSHAsHeader
|
, Unused.CLI.Views.GitSHAsHeader
|
||||||
|
Loading…
Reference in New Issue
Block a user