diff options
Diffstat (limited to 'Command/Find.hs')
-rw-r--r-- | Command/Find.hs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/Command/Find.hs b/Command/Find.hs index 47058fa25..6050ff7bb 100644 --- a/Command/Find.hs +++ b/Command/Find.hs @@ -7,11 +7,16 @@ module Command.Find where +import qualified Data.Map as M + import Common.Annex import Command import Annex.Content import Limit import qualified Annex +import qualified Utility.Format +import Utility.DataUnits +import Types.Key def :: [Command] def = [command "find" paramPaths seek "lists available files"] @@ -24,8 +29,18 @@ start file (key, _) = do -- only files inAnnex are shown, unless the user has requested -- others via a limit whenM (liftM2 (||) (inAnnex key) limited) $ do - print0 <- Annex.getState Annex.print0 - if print0 - then liftIO $ putStr (file ++ "\0") - else liftIO $ putStrLn file + f <- Annex.getState Annex.format + case f of + Nothing -> liftIO $ putStrLn file + Just formatter -> liftIO $ putStr $ + Utility.Format.format formatter vars stop + where + vars = M.fromList + [ ("file", file) + , ("key", show key) + , ("backend", keyBackendName key) + , ("bytesize", size show) + , ("humansize", size $ roughSize storageUnits True) + ] + size c = maybe "unknown" c $ keySize key |