summaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-11 00:51:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-11 00:51:07 -0400
commit264bd9ebe37855d4005022df057da13ec8080afb (patch)
treef32f13646ece29c8f6336b8680cb07dd55187be5 /Command.hs
parentd9f5cc9f73ea046fcd2b59b5e75d4600593ac05b (diff)
where indenting
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs46
1 files changed, 23 insertions, 23 deletions
diff --git a/Command.hs b/Command.hs
index 8e7bf9758..bac26667d 100644
--- a/Command.hs
+++ b/Command.hs
@@ -80,14 +80,14 @@ prepCommand Command { cmdseek = seek, cmdcheck = c } params = do
{- Runs a command through the start, perform and cleanup stages -}
doCommand :: CommandStart -> CommandCleanup
doCommand = start
- where
- start = stage $ maybe skip perform
- perform = stage $ maybe failure cleanup
- cleanup = stage $ status
- stage = (=<<)
- skip = return True
- failure = showEndFail >> return False
- status r = showEndResult r >> return r
+ where
+ start = stage $ maybe skip perform
+ perform = stage $ maybe failure cleanup
+ cleanup = stage $ status
+ stage = (=<<)
+ skip = return True
+ failure = showEndFail >> return False
+ status r = showEndResult r >> return r
{- Modifies an action to only act on files that are already annexed,
- and passes the key and backend on to it. -}
@@ -118,26 +118,26 @@ numCopies file = readish <$> checkAttr "annex.numcopies" file
-}
autoCopies :: FilePath -> Key -> (Int -> Int -> Bool) -> CommandStart -> CommandStart
autoCopies file key vs a = Annex.getState Annex.auto >>= go
- where
- go False = a
- go True = do
- numcopiesattr <- numCopies file
- needed <- getNumCopies numcopiesattr
- (_, have) <- trustPartition UnTrusted =<< Remote.keyLocations key
- if length have `vs` needed then a else stop
+ where
+ go False = a
+ go True = do
+ numcopiesattr <- numCopies file
+ needed <- getNumCopies numcopiesattr
+ have <- trustExclude UnTrusted =<< Remote.keyLocations key
+ if length have `vs` needed then a else stop
autoCopiesWith :: FilePath -> Key -> (Int -> Int -> Bool) -> (Maybe Int -> CommandStart) -> CommandStart
autoCopiesWith file key vs a = do
numcopiesattr <- numCopies file
Annex.getState Annex.auto >>= auto numcopiesattr
- where
- auto numcopiesattr False = a numcopiesattr
- auto numcopiesattr True = do
- needed <- getNumCopies numcopiesattr
- (_, have) <- trustPartition UnTrusted =<< Remote.keyLocations key
- if length have `vs` needed
- then a numcopiesattr
- else stop
+ where
+ auto numcopiesattr False = a numcopiesattr
+ auto numcopiesattr True = do
+ needed <- getNumCopies numcopiesattr
+ have <- trustExclude UnTrusted =<< Remote.keyLocations key
+ if length have `vs` needed
+ then a numcopiesattr
+ else stop
checkAuto :: Annex Bool -> Annex Bool
checkAuto checker = ifM (Annex.getState Annex.auto)