add --batch

This commit is contained in:
Joey Hess 2016-01-19 17:46:46 -04:00
parent 5a781f4e8f
commit 7d0ece86f6
Failed to extract signature
6 changed files with 51 additions and 13 deletions

View file

@ -134,15 +134,20 @@ includeCommandAction a = account =<< tryIO (callCommandAction a)
- stages, without catching errors. Useful if one command wants to run
- part of another command. -}
callCommandAction :: CommandStart -> CommandCleanup
callCommandAction = start
callCommandAction = fromMaybe True <$$> callCommandAction'
{- Like callCommandAction, but returns Nothing when the command did not
- perform any action. -}
callCommandAction' :: CommandStart -> Annex (Maybe Bool)
callCommandAction' = start
where
start = stage $ maybe skip perform
perform = stage $ maybe failure cleanup
cleanup = stage $ status
stage = (=<<)
skip = return True
failure = showEndFail >> return False
status r = showEndResult r >> return r
skip = return Nothing
failure = showEndFail >> return (Just False)
status r = showEndResult r >> return (Just r)
{- Do concurrent output when that has been requested. -}
allowConcurrentOutput :: Annex a -> Annex a