fromkey --json

* fromkey: Added --json.
* fromkey --batch output changed to support using it with --json.
  The old output was not parseable for any useful information, so
  this is not expected to break anything.
This commit is contained in:
Joey Hess 2019-02-05 14:03:29 -04:00
parent 7b46b43c48
commit b080699a95
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 61 additions and 37 deletions

View file

@ -93,15 +93,15 @@ batchCommandAction a = maybe (batchBadInput (Batch BatchLine)) (const noop)
-- to handle them.
--
-- File matching options are not checked.
allBatchFiles :: BatchFormat -> (FilePath -> CommandStart) -> Annex ()
allBatchFiles fmt a = batchInput fmt Right $ batchCommandAction . a
batchStart :: BatchFormat -> (String -> CommandStart) -> Annex ()
batchStart fmt a = batchInput fmt Right $ batchCommandAction . a
-- Like allBatchFiles, but checks the file matching options
-- Like batchStart, but checks the file matching options
-- and skips non-matching files.
batchFilesMatching :: BatchFormat -> (FilePath -> CommandStart) -> Annex ()
batchFilesMatching fmt a = do
matcher <- getMatcher
allBatchFiles fmt $ \f ->
batchStart fmt $ \f ->
ifM (matcher $ MatchingFile $ FileInfo f f)
( a f
, return Nothing