Skip to content

Commit 0e7fe05

Browse files
committed
standardize how $pretty* stuff is aligned after labels
1 parent ab9d5b7 commit 0e7fe05

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/Stack/PrettyPrint.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module Stack.PrettyPrint
2828
, hsep, vsep, fillSep, sep, hcat, vcat, fillCat, cat, punctuate
2929
, fill, fillBreak
3030
, enclose, squotes, dquotes, parens, angles, braces, brackets
31+
, indentAfterLabel
3132
) where
3233

3334
import Stack.Prelude
@@ -65,12 +66,15 @@ prettyInfo = do
6566
prettyWarn :: Q Exp
6667
prettyWarn = do
6768
loc <- location
68-
[e| monadLoggerLog loc "" LevelWarn <=< displayWithColor . (line <>) . (warningColor "Warning:" <+>) |]
69+
[e| monadLoggerLog loc "" LevelWarn <=< displayWithColor . (line <>) . (warningColor "Warning:" <+>) . indentAfterLabel |]
6970

7071
prettyError :: Q Exp
7172
prettyError = do
7273
loc <- location
73-
[e| monadLoggerLog loc "" LevelError <=< displayWithColor . (line <>) . (errorColor "Error:" <+>) |]
74+
[e| monadLoggerLog loc "" LevelError <=< displayWithColor . (line <>) . (errorColor "Error:" <+>) . indentAfterLabel |]
75+
76+
indentAfterLabel :: Doc a -> Doc a
77+
indentAfterLabel = align
7478

7579
debugBracket :: Q Exp
7680
debugBracket = do

src/main/Main.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ buildCmd opts go = do
607607

608608
uninstallCmd :: [String] -> GlobalOpts -> IO ()
609609
uninstallCmd _ go = withConfigAndLock go $ do
610-
$prettyError . align . fillSep . (++ [cmd])
610+
$prettyError . fillSep . (++ [cmd])
611611
. map fromString . concatMap words $
612612
["stack does not manage installations in global locations.",
613613
"The only global mutation stack performs is executable copying.",
@@ -638,7 +638,7 @@ upgradeCmd upgradeOpts' go = withGlobalConfigAndLock go $
638638
-- | Upload to Hackage
639639
uploadCmd :: SDistOpts -> GlobalOpts -> IO ()
640640
uploadCmd (SDistOpts [] _ _ _ _ _) go =
641-
withConfigAndLock go . $prettyError . align . sep $
641+
withConfigAndLock go . $prettyError . sep $
642642
["To upload the current package, please run",
643643
shellColor (fromString "stack upload ."),
644644
"(with the period at the end)"]
@@ -653,7 +653,7 @@ uploadCmd sdistOpts go = do
653653
withBuildConfigAndLock go $ \_ -> do
654654
unless (null invalid) $ do
655655
let invalidList = bulletedList $ map (fileColor . fromString) invalid
656-
$prettyError . align . (<> (line <> invalidList))
656+
$prettyError . (<> (line <> invalidList))
657657
. sep . map fromString $
658658
["stack upload expects a list of sdist tarballs or cabal directories.",
659659
"Can't find:"]

0 commit comments

Comments
 (0)