reuse strings
This commit is contained in:
parent
a5d89633c3
commit
5e9f0a3493
2 changed files with 7 additions and 7 deletions
11
Messages.hs
11
Messages.hs
|
@ -19,6 +19,7 @@ module Messages (
|
||||||
showEndOk,
|
showEndOk,
|
||||||
showEndFail,
|
showEndFail,
|
||||||
showEndResult,
|
showEndResult,
|
||||||
|
endResult,
|
||||||
showErr,
|
showErr,
|
||||||
warning,
|
warning,
|
||||||
warningIO,
|
warningIO,
|
||||||
|
@ -111,11 +112,11 @@ showEndFail :: Annex ()
|
||||||
showEndFail = showEndResult False
|
showEndFail = showEndResult False
|
||||||
|
|
||||||
showEndResult :: Bool -> Annex ()
|
showEndResult :: Bool -> Annex ()
|
||||||
showEndResult ok = handleMessage (JSON.end ok) $ putStrLn msg
|
showEndResult ok = handleMessage (JSON.end ok) $ putStrLn $ endResult ok
|
||||||
where
|
|
||||||
msg
|
endResult :: Bool -> String
|
||||||
| ok = "ok"
|
endResult True = "ok"
|
||||||
| otherwise = "failed"
|
endResult False = "failed"
|
||||||
|
|
||||||
showErr :: (Show a) => a -> Annex ()
|
showErr :: (Show a) => a -> Annex ()
|
||||||
showErr e = warning' $ "git-annex: " ++ show e
|
showErr e = warning' $ "git-annex: " ++ show e
|
||||||
|
|
|
@ -42,8 +42,7 @@ metered combinemeterupdate key af a = case keySize key of
|
||||||
, pgTotal = size
|
, pgTotal = size
|
||||||
, pgOnCompletion = do
|
, pgOnCompletion = do
|
||||||
ok <- takeMVar result
|
ok <- takeMVar result
|
||||||
putStrLn $ desc ++ " " ++
|
putStrLn $ desc ++ " " ++ endResult ok
|
||||||
if ok then "ok" else "failed"
|
|
||||||
}
|
}
|
||||||
r <- a $ liftIO . pupdate pg
|
r <- a $ liftIO . pupdate pg
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue