aboutsummaryrefslogtreecommitdiff
path: root/Command/Get.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-07-05 08:56:23 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-07-05 08:57:45 -0400
commit7ec6b7ca1fb2acebe0f1669239aa81b5a63ecf5d (patch)
tree88ff3b14da0ae3d43591927656b9b95c4487429b /Command/Get.hs
parente06dda9501b3e990c2d6a8b249787520d08ba6fe (diff)
get: Add --batch and --json options.
Diffstat (limited to 'Command/Get.hs')
-rw-r--r--Command/Get.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/Command/Get.hs b/Command/Get.hs
index f49d202e1..a56661ef4 100644
--- a/Command/Get.hs
+++ b/Command/Get.hs
@@ -16,7 +16,7 @@ import Annex.Wanted
import qualified Command.Move
cmd :: Command
-cmd = withGlobalOptions (jobsOption : annexedMatchingOptions) $
+cmd = withGlobalOptions (jobsOption : jsonOption : annexedMatchingOptions) $
command "get" SectionCommon
"make content of annexed files available"
paramPaths (seek <$$> optParser)
@@ -26,6 +26,7 @@ data GetOptions = GetOptions
, getFrom :: Maybe (DeferredParse Remote)
, autoMode :: Bool
, keyOptions :: Maybe KeyOptions
+ , batchOption :: BatchMode
}
optParser :: CmdParamsDesc -> Parser GetOptions
@@ -34,14 +35,18 @@ optParser desc = GetOptions
<*> optional parseFromOption
<*> parseAutoOption
<*> optional (parseKeyOptions True)
+ <*> parseBatchOption
seek :: GetOptions -> CommandSeek
seek o = allowConcurrentOutput $ do
from <- maybe (pure Nothing) (Just <$$> getParsed) (getFrom o)
- withKeyOptions (keyOptions o) (autoMode o)
- (startKeys from)
- (withFilesInGit $ whenAnnexed $ start o from)
- (getFiles o)
+ let go = whenAnnexed $ start o from
+ case batchOption o of
+ Batch -> batchInput Right (batchCommandAction . go)
+ NoBatch -> withKeyOptions (keyOptions o) (autoMode o)
+ (startKeys from)
+ (withFilesInGit go)
+ (getFiles o)
start :: GetOptions -> Maybe Remote -> FilePath -> Key -> CommandStart
start o from file key = start' expensivecheck from key (Just file)