diff options
author | Joey Hess <joey@kitenet.net> | 2011-05-15 02:02:46 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-05-15 02:02:46 -0400 |
commit | 56bc3e95cabb85e5f23e30b453f90438c33efbb8 (patch) | |
tree | c13ac69cfc2b5ba9582aa5c1ebd427bc0d337b16 /Command/Drop.hs | |
parent | b400984ddf9aeb24c3d67e87cfeb29470618636c (diff) |
refactor some boilerplate
Diffstat (limited to 'Command/Drop.hs')
-rw-r--r-- | Command/Drop.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs index 52b724e62..05c956fdd 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -29,11 +29,11 @@ seek = [withAttrFilesInGit "annex.numcopies" start] start :: CommandStartAttrFile start (file, attr) = isAnnexed file $ \(key, backend) -> do inbackend <- Backend.hasKey key - if not inbackend - then return Nothing - else do + if inbackend + then do showStart "drop" file - return $ Just $ perform key backend numcopies + next $ perform key backend numcopies + else stop where numcopies = readMaybe attr :: Maybe Int @@ -41,8 +41,8 @@ perform :: Key -> Backend Annex -> Maybe Int -> CommandPerform perform key backend numcopies = do success <- Backend.removeKey backend key numcopies if success - then return $ Just $ cleanup key - else return Nothing + then next $ cleanup key + else stop cleanup :: Key -> CommandCleanup cleanup key = do |