diff options
Diffstat (limited to 'Command.hs')
-rw-r--r-- | Command.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Command.hs b/Command.hs index 86a83e30c..813a239cb 100644 --- a/Command.hs +++ b/Command.hs @@ -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] |