summaryrefslogtreecommitdiff
path: root/Command/Find.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-22 22:03:18 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-23 01:08:19 -0400
commitfdf02986cf2c7db74cc8ca8ebd2786922652ff9b (patch)
treed6a61cdf01df8b3e635f71a7dc3adfdd43a0a8f8 /Command/Find.hs
parent7227dd8f21f24c2ccadd38e1a3dec7b888a23e92 (diff)
find --json
Diffstat (limited to 'Command/Find.hs')
-rw-r--r--Command/Find.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/Command/Find.hs b/Command/Find.hs
index 6050ff7bb..91386bbd0 100644
--- a/Command/Find.hs
+++ b/Command/Find.hs
@@ -28,15 +28,17 @@ start :: FilePath -> (Key, Backend Annex) -> CommandStart
start file (key, _) = do
-- only files inAnnex are shown, unless the user has requested
-- others via a limit
- whenM (liftM2 (||) (inAnnex key) limited) $ do
- f <- Annex.getState Annex.format
- case f of
- Nothing -> liftIO $ putStrLn file
- Just formatter -> liftIO $ putStr $
- Utility.Format.format formatter vars
+ whenM (liftM2 (||) (inAnnex key) limited) $
+ unlessM (showFullJSON vars) $ do
+ f <- Annex.getState Annex.format
+ case f of
+ Nothing -> liftIO $ putStrLn file
+ Just formatter -> liftIO $ putStr $
+ Utility.Format.format formatter $
+ M.fromList vars
stop
where
- vars = M.fromList
+ vars =
[ ("file", file)
, ("key", show key)
, ("backend", keyBackendName key)