summaryrefslogtreecommitdiff
path: root/Messages.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-26 20:30:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-26 20:30:07 -0400
commitc30d38e108ade7eb4fa57552631b64dd3b9582c4 (patch)
tree4afc2ae95f1dbebe2d9a7dd4b177fb64fa3b8273 /Messages.hs
parent3cb5cb6bf6f03ad3ef574a14ed35275916ac44b3 (diff)
better warnings display
Diffstat (limited to 'Messages.hs')
-rw-r--r--Messages.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/Messages.hs b/Messages.hs
index 2b9862230..6f4ec1e62 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -37,9 +37,8 @@ showProgress :: Annex ()
showProgress = verbose $ liftIO $ putStr "\n"
showLongNote :: String -> Annex ()
-showLongNote s = verbose $ liftIO $ putStr $ "\n" ++ indented
- where
- indented = join "\n" $ map (\l -> " " ++ l) $ lines s
+showLongNote s = verbose $ liftIO $ putStr $ "\n" ++ indent s
+
showEndOk :: Annex ()
showEndOk = verbose $ liftIO $ putStrLn "ok"
@@ -48,9 +47,13 @@ showEndFail = verbose $ liftIO $ putStrLn "\nfailed"
{- Exception pretty-printing. -}
showErr :: (Show a) => a -> Annex ()
-showErr e = warning $ show e
+showErr e = warning $ "git-annex: " ++ show e
warning :: String -> Annex ()
-warning s = do
+warning w = do
verbose $ liftIO $ putStr "\n"
- liftIO $ hPutStrLn stderr $ "git-annex: " ++ s ++ " "
+ liftIO $ hFlush stdout
+ liftIO $ hPutStrLn stderr $ indent w
+
+indent :: String -> String
+indent s = join "\n" $ map (\l -> " " ++ l) $ lines s