factor out a stopUnless
code melt for lunch
This commit is contained in:
parent
d64132a43a
commit
3f5f28b487
9 changed files with 69 additions and 107 deletions
|
@ -10,6 +10,7 @@ module Command (
|
|||
noRepo,
|
||||
next,
|
||||
stop,
|
||||
stopUnless,
|
||||
prepCommand,
|
||||
doCommand,
|
||||
whenAnnexed,
|
||||
|
@ -49,6 +50,12 @@ next a = return $ Just a
|
|||
stop :: Annex (Maybe a)
|
||||
stop = return Nothing
|
||||
|
||||
{- Stops unless a condition is met. -}
|
||||
stopUnless :: Annex Bool -> Annex (Maybe a) -> Annex (Maybe a)
|
||||
stopUnless c a = do
|
||||
ok <- c
|
||||
if ok then a else stop
|
||||
|
||||
{- Prepares to run a command via the check and seek stages, returning a
|
||||
- list of actions to perform to run the command. -}
|
||||
prepCommand :: Command -> [String] -> Annex [CommandCleanup]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue