summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-20 12:46:00 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-20 12:46:00 -0400
commit7b5ddc7a4e972cfa3d14fbefc6610fddbfcff4b7 (patch)
treed5eb70b0659e897349b79e6674d5c201d192faa0 /Command
parentc5f532e7d7a13ed9f43fe9d50a1dc6521afce4f2 (diff)
whereis --batch
Diffstat (limited to 'Command')
-rw-r--r--Command/Add.hs3
-rw-r--r--Command/Whereis.hs17
2 files changed, 13 insertions, 7 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index f2fcd2fb1..e85cdd6c1 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -55,8 +55,7 @@ seek o = allowConcurrentOutput $ do
, startSmall file
)
case batchOption o of
- Batch -> batchInput Right $
- batchCommandAction . gofile
+ Batch -> batchFiles gofile
NoBatch -> do
let go a = a gofile (addThese o)
go (withFilesNotInGit (not $ includeDotFiles o))
diff --git a/Command/Whereis.hs b/Command/Whereis.hs
index 9117cde9e..bf4cbfe97 100644
--- a/Command/Whereis.hs
+++ b/Command/Whereis.hs
@@ -1,6 +1,6 @@
{- git-annex command
-
- - Copyright 2010-2014 Joey Hess <id@joeyh.name>
+ - Copyright 2010-2016 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -14,6 +14,7 @@ import Logs.Trust
import Logs.Web
import Remote.Web (getWebUrls)
import Annex.UUID
+import CmdLine.Batch
import qualified Data.Map as M
@@ -26,20 +27,26 @@ cmd = noCommit $ withGlobalOptions (jsonOption : annexedMatchingOptions) $
data WhereisOptions = WhereisOptions
{ whereisFiles :: CmdParams
, keyOptions :: Maybe KeyOptions
+ , batchOption :: BatchMode
}
optParser :: CmdParamsDesc -> Parser WhereisOptions
optParser desc = WhereisOptions
<$> cmdParams desc
<*> optional (parseKeyOptions False)
+ <*> parseBatchOption
seek :: WhereisOptions -> CommandSeek
seek o = do
m <- remoteMap id
- withKeyOptions (keyOptions o) False
- (startKeys m)
- (withFilesInGit $ whenAnnexed $ start m)
- (whereisFiles o)
+ let go = whenAnnexed $ start m
+ case batchOption o of
+ Batch -> batchFiles go
+ NoBatch ->
+ withKeyOptions (keyOptions o) False
+ (startKeys m)
+ (withFilesInGit go)
+ (whereisFiles o)
start :: M.Map UUID Remote -> FilePath -> Key -> CommandStart
start remotemap file key = start' remotemap key (Just file)