summaryrefslogtreecommitdiff
path: root/Command/Find.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/Find.hs')
-rw-r--r--Command/Find.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/Command/Find.hs b/Command/Find.hs
index c86db5fa6..eb0267c14 100644
--- a/Command/Find.hs
+++ b/Command/Find.hs
@@ -23,20 +23,25 @@ def = [withOptions [formatOption, print0Option] $
command "find" paramPaths seek "lists available files"]
print0Option :: Option
-print0Option = Option [] ["print0"] (NoArg $ setFormat "${file}\0")
+print0Option = Option [] ["print0"] (NoArg $ Annex.setField "format" "${file}\0")
"terminate output with null"
+formatOption :: Option
+formatOption = fieldOption [] "format" paramFormat "control format of output"
+
seek :: [CommandSeek]
-seek = [withFilesInGit $ whenAnnexed start]
+seek = [withField "format" formatconverter $ \f ->
+ withFilesInGit $ whenAnnexed $ start f]
+ where
+ formatconverter = maybe Nothing (Just . Utility.Format.gen)
-start :: FilePath -> (Key, Backend) -> CommandStart
-start file (key, _) = do
+start :: Maybe Utility.Format.Format -> FilePath -> (Key, Backend) -> CommandStart
+start format file (key, _) = do
-- only files inAnnex are shown, unless the user has requested
-- others via a limit
whenM (liftM2 (||) limited (inAnnex key)) $
- unlessM (showFullJSON vars) $ do
- f <- Annex.getState Annex.format
- case f of
+ unlessM (showFullJSON vars) $
+ case format of
Nothing -> liftIO $ putStrLn file
Just formatter -> liftIO $ putStr $
Utility.Format.format formatter $