mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-08-15 15:50:26 +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
|
||||
|
||||
import Unused.CLI.Util
|
||||
import Unused.CLI.Views.Error
|
||||
import Unused.ResultsClassifier (ParseConfigError(..))
|
||||
|
||||
invalidConfigError :: [ParseConfigError] -> IO ()
|
||||
invalidConfigError es = do
|
||||
setSGR [SetColor Background Vivid Red]
|
||||
setSGR [SetColor Foreground Vivid White]
|
||||
setSGR [SetConsoleIntensity BoldIntensity]
|
||||
|
||||
putStrLn "\nThere was a problem with the following config file(s):\n"
|
||||
|
||||
setSGR [Reset]
|
||||
errorHeader "There was a problem with the following config file(s):"
|
||||
|
||||
mapM_ configError es
|
||||
|
||||
|
@ -4,18 +4,13 @@ module Unused.CLI.Views.MissingTagsFileError
|
||||
|
||||
import Unused.TagsSource
|
||||
import Unused.CLI.Util
|
||||
import Unused.CLI.Views.Error
|
||||
|
||||
missingTagsFileError :: TagSearchOutcome -> IO ()
|
||||
missingTagsFileError e = do
|
||||
setSGR [SetColor Background Vivid Red]
|
||||
setSGR [SetColor Foreground Vivid White]
|
||||
setSGR [SetConsoleIntensity BoldIntensity]
|
||||
|
||||
putStrLn "\nThere was a problem finding a tags file.\n"
|
||||
|
||||
setSGR [Reset]
|
||||
|
||||
errorHeader "There was a problem finding a tags file."
|
||||
printOutcomeMessage e
|
||||
|
||||
putStr "\n"
|
||||
|
||||
setSGR [SetConsoleIntensity BoldIntensity]
|
||||
|
@ -42,6 +42,7 @@ library
|
||||
, Unused.CLI.GitContext
|
||||
, Unused.CLI.Util
|
||||
, Unused.CLI.Views
|
||||
, Unused.CLI.Views.Error
|
||||
, Unused.CLI.Views.NoResultsFound
|
||||
, Unused.CLI.Views.AnalysisHeader
|
||||
, Unused.CLI.Views.GitSHAsHeader
|
||||
|
Loading…
Reference in New Issue
Block a user