Skip to content

Commit 1821d80

Browse files
committed
Improve formatting of cabal check output
1 parent d31d1ca commit 1821d80

File tree

1 file changed

+9
-9
lines changed
  • cabal-install/Distribution/Client

1 file changed

+9
-9
lines changed

cabal-install/Distribution/Client/Check.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Distribution.PackageDescription.Configuration
2525
import Distribution.Verbosity
2626
( Verbosity )
2727
import Distribution.Simple.Utils
28-
( defaultPackageDesc, toUTF8 )
28+
( defaultPackageDesc, toUTF8, wrapText )
2929

3030
check :: Verbosity -> IO Bool
3131
check verbosity = do
@@ -54,23 +54,19 @@ check verbosity = do
5454

5555
unless (null buildImpossible) $ do
5656
putStrLn "The package will not build sanely due to these errors:"
57-
mapM_ (putStrLn . toUTF8. explanation) buildImpossible
58-
putStrLn ""
57+
printCheckMessages buildImpossible
5958

6059
unless (null buildWarning) $ do
6160
putStrLn "The following warnings are likely affect your build negatively:"
62-
mapM_ (putStrLn . toUTF8 . explanation) buildWarning
63-
putStrLn ""
61+
printCheckMessages buildWarning
6462

6563
unless (null distSuspicious) $ do
6664
putStrLn "These warnings may cause trouble when distributing the package:"
67-
mapM_ (putStrLn . toUTF8 . explanation) distSuspicious
68-
putStrLn ""
65+
printCheckMessages distSuspicious
6966

7067
unless (null distInexusable) $ do
7168
putStrLn "The following errors will cause portability problems on other environments:"
72-
mapM_ (putStrLn . toUTF8 . explanation) distInexusable
73-
putStrLn ""
69+
printCheckMessages distInexusable
7470

7571
let isDistError (PackageDistSuspicious {}) = False
7672
isDistError _ = True
@@ -83,3 +79,7 @@ check verbosity = do
8379
putStrLn "No errors or warnings could be found in the package."
8480

8581
return (null packageChecks)
82+
83+
where
84+
printCheckMessages = mapM_ (putStrLn . format . explanation)
85+
format = toUTF8 . wrapText . ("* "++)

0 commit comments

Comments
 (0)