summaryrefslogtreecommitdiff
path: root/Command/SendKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-17 03:10:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-17 03:13:11 -0400
commitc91929f6934fc4e94603d0fa004e824d5e2cfb65 (patch)
treee958f5b4dc1209afb90c786493164c351dea4b9a /Command/SendKey.hs
parent75a3f5027f74565d909fb940893636d081d9872a (diff)
add whenM and unlessM
Just more golfing.. I am pretty sure something in a library somewhere can do this, but I have been unable to find it.
Diffstat (limited to 'Command/SendKey.hs')
-rw-r--r--Command/SendKey.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/Command/SendKey.hs b/Command/SendKey.hs
index 871a530af..7497ce3bf 100644
--- a/Command/SendKey.hs
+++ b/Command/SendKey.hs
@@ -7,7 +7,6 @@
module Command.SendKey where
-import Control.Monad (when)
import Control.Monad.State (liftIO)
import System.Exit
@@ -15,6 +14,7 @@ import Locations
import qualified Annex
import Command
import Content
+import Utility
import RsyncFile
command :: [Command]
@@ -26,9 +26,8 @@ seek = [withKeys start]
start :: CommandStartKey
start key = do
- present <- inAnnex key
g <- Annex.gitRepo
let file = gitAnnexLocation g key
- when present $
- liftIO $ rsyncServerSend file
+ whenM (inAnnex key) $
+ liftIO $ rsyncServerSend file -- does not return
liftIO exitFailure