aboutsummaryrefslogtreecommitdiff
path: root/Messages.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-11 14:43:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-11 14:43:45 -0400
commitb505ba83e8b62a9ed0ec2fb96448c5fc801184d9 (patch)
tree664eb4af9f274dfc13eb9abfab86421ebe38e881 /Messages.hs
parent025ded4a2dfb58a6ec0cb47b9d625d593a4e1977 (diff)
minor syntax changes
Diffstat (limited to 'Messages.hs')
-rw-r--r--Messages.hs27
1 files changed, 15 insertions, 12 deletions
diff --git a/Messages.hs b/Messages.hs
index e029c5072..6f4880e2d 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -31,31 +31,31 @@ import qualified Annex
import qualified Messages.JSON as JSON
showStart :: String -> String -> Annex ()
-showStart command file = handle (JSON.start command file) $ do
- putStr $ command ++ " " ++ file ++ " "
- hFlush stdout
+showStart command file = handle (JSON.start command file) $
+ flushed $ putStr $ command ++ " " ++ file ++ " "
showNote :: String -> Annex ()
-showNote s = handle (JSON.note s) $ do
- putStr $ "(" ++ s ++ ") "
- hFlush stdout
+showNote s = handle (JSON.note s) $
+ flushed $ putStr $ "(" ++ s ++ ") "
showAction :: String -> Annex ()
showAction s = showNote $ s ++ "..."
showProgress :: Annex ()
-showProgress = handle q $ do
- putStr "."
- hFlush stdout
+showProgress = handle q $
+ flushed $ putStr "."
showSideAction :: String -> Annex ()
-showSideAction s = handle q $ putStrLn $ "(" ++ s ++ "...)"
+showSideAction s = handle q $
+ putStrLn $ "(" ++ s ++ "...)"
showOutput :: Annex ()
-showOutput = handle q $ putStr "\n"
+showOutput = handle q $
+ putStr "\n"
showLongNote :: String -> Annex ()
-showLongNote s = handle (JSON.note s) $ putStrLn $ '\n' : indent s
+showLongNote s = handle (JSON.note s) $
+ putStrLn $ '\n' : indent s
showEndOk :: Annex ()
showEndOk = showEndResult True
@@ -113,3 +113,6 @@ maybeShowJSON v = handle (JSON.add v) q
q :: Monad m => m ()
q = return ()
+
+flushed :: IO () -> IO ()
+flushed a = a >> hFlush stdout