diff --git a/CmdLine/GitAnnex.hs b/CmdLine/GitAnnex.hs index 68a9e27ca7..391237ca1c 100644 --- a/CmdLine/GitAnnex.hs +++ b/CmdLine/GitAnnex.hs @@ -57,7 +57,7 @@ import qualified Command.Unlock import qualified Command.Lock import qualified Command.PreCommit import qualified Command.Find ---import qualified Command.FindRef +import qualified Command.FindRef import qualified Command.Whereis --import qualified Command.List --import qualified Command.Log @@ -184,7 +184,7 @@ cmds = , Command.DropUnused.cmd , Command.AddUnused.cmd , Command.Find.cmd --- , Command.FindRef.cmd + , Command.FindRef.cmd , Command.Whereis.cmd -- , Command.List.cmd -- , Command.Log.cmd diff --git a/Command/Find.hs b/Command/Find.hs index dd82bd4015..ae5595c1d6 100644 --- a/Command/Find.hs +++ b/Command/Find.hs @@ -48,14 +48,14 @@ parseFormatOption = ) seek :: FindOptions -> CommandSeek -seek o = withFilesInGit (whenAnnexed $ start (formatOption o)) (findThese o) +seek o = withFilesInGit (whenAnnexed $ start o) (findThese o) -start :: Maybe Utility.Format.Format -> FilePath -> Key -> CommandStart -start format file key = do +start :: FindOptions -> FilePath -> Key -> CommandStart +start o file key = do -- only files inAnnex are shown, unless the user has requested -- others via a limit whenM (limited <||> inAnnex key) $ - showFormatted format file $ ("file", file) : keyVars key + showFormatted (formatOption o) file $ ("file", file) : keyVars key stop showFormatted :: Maybe Utility.Format.Format -> String -> [(String, String)] -> Annex () diff --git a/Command/FindRef.hs b/Command/FindRef.hs index cd7583b96f..8de7d9e594 100644 --- a/Command/FindRef.hs +++ b/Command/FindRef.hs @@ -7,16 +7,15 @@ module Command.FindRef where +import Common.Annex import Command import qualified Command.Find as Find cmd :: Command -cmd = withOptions nonWorkTreeMatchingOptions $ Find.mkCommand $ +cmd = withGlobalOptions nonWorkTreeMatchingOptions $ Find.mkCommand $ command "findref" SectionPlumbing "lists files in a git ref" - paramRef (withParams seek) + paramRef (seek <$$> Find.optParser) -seek :: CmdParams -> CommandSeek -seek refs = do - format <- Find.getFormat - Find.start format `withFilesInRefs` refs +seek :: Find.FindOptions -> CommandSeek +seek o = Find.start o `withFilesInRefs` Find.findThese o