reuse strings

This commit is contained in:
Joey Hess 2015-04-14 16:46:06 -04:00
parent a5d89633c3
commit 5e9f0a3493
2 changed files with 7 additions and 7 deletions

View file

@ -19,6 +19,7 @@ module Messages (
showEndOk,
showEndFail,
showEndResult,
endResult,
showErr,
warning,
warningIO,
@ -111,11 +112,11 @@ showEndFail :: Annex ()
showEndFail = showEndResult False
showEndResult :: Bool -> Annex ()
showEndResult ok = handleMessage (JSON.end ok) $ putStrLn msg
where
msg
| ok = "ok"
| otherwise = "failed"
showEndResult ok = handleMessage (JSON.end ok) $ putStrLn $ endResult ok
endResult :: Bool -> String
endResult True = "ok"
endResult False = "failed"
showErr :: (Show a) => a -> Annex ()
showErr e = warning' $ "git-annex: " ++ show e

View file

@ -42,8 +42,7 @@ metered combinemeterupdate key af a = case keySize key of
, pgTotal = size
, pgOnCompletion = do
ok <- takeMVar result
putStrLn $ desc ++ " " ++
if ok then "ok" else "failed"
putStrLn $ desc ++ " " ++ endResult ok
}
r <- a $ liftIO . pupdate pg