diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-09 12:23:45 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-09 12:23:45 -0400 |
commit | 3f5f28b48754bc91620a6354ca70afe4c61c9894 (patch) | |
tree | 6c71b52187f442ce619ffac7c672fc7f0b8f84ce /Command/DropKey.hs | |
parent | d64132a43ae176e8a1353d5463c5387a93da9ad7 (diff) |
factor out a stopUnless
code melt for lunch
Diffstat (limited to 'Command/DropKey.hs')
-rw-r--r-- | Command/DropKey.hs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/Command/DropKey.hs b/Command/DropKey.hs index b63d481bf..ae2ad8b6a 100644 --- a/Command/DropKey.hs +++ b/Command/DropKey.hs @@ -21,18 +21,11 @@ seek :: [CommandSeek] seek = [withKeys start] start :: Key -> CommandStart -start key = do - present <- inAnnex key - if not present - then stop - else do - checkforced - showStart "dropkey" (show key) - next $ perform key - where - checkforced = - unlessM (Annex.getState Annex.force) $ - error "dropkey can cause data loss; use --force if you're sure you want to do this" +start key = stopUnless (not <$> inAnnex key) $ do + unlessM (Annex.getState Annex.force) $ + error "dropkey can cause data loss; use --force if you're sure you want to do this" + showStart "dropkey" (show key) + next $ perform key perform :: Key -> CommandPerform perform key = lockContent key $ do |