find --json

This commit is contained in:
Joey Hess 2011-12-22 22:03:18 -04:00
parent 7227dd8f21
commit fdf02986cf
4 changed files with 28 additions and 10 deletions

View file

@ -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)