From e23a4eb3c9e9a6bc39a5a59fe45300e8fdfb0916 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Apr 2014 18:41:24 -0400 Subject: findref: New command, like find but shows files in a specified git ref. --- Command/Find.hs | 6 ++++-- Command/FindRef.hs | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 Command/FindRef.hs (limited to 'Command') diff --git a/Command/Find.hs b/Command/Find.hs index bcf83729a..c800933f9 100644 --- a/Command/Find.hs +++ b/Command/Find.hs @@ -19,8 +19,10 @@ import Utility.DataUnits import Types.Key def :: [Command] -def = [noCommit $ noMessages $ withOptions [formatOption, print0Option, jsonOption] $ - command "find" paramPaths seek SectionQuery "lists available files"] +def = [mkCommand $ command "find" paramPaths seek SectionQuery "lists available files"] + +mkCommand :: Command -> Command +mkCommand = noCommit . noMessages . withOptions [formatOption, print0Option, jsonOption] formatOption :: Option formatOption = fieldOption [] "format" paramFormat "control format of output" diff --git a/Command/FindRef.hs b/Command/FindRef.hs new file mode 100644 index 000000000..26007f7c0 --- /dev/null +++ b/Command/FindRef.hs @@ -0,0 +1,20 @@ +{- git-annex command + - + - Copyright 2014 Joey Hess + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Command.FindRef where + +import Command +import qualified Command.Find as Find + +def :: [Command] +def = [Find.mkCommand $ command "findref" paramRef seek SectionPlumbing + "lists files in a git ref"] + +seek :: CommandSeek +seek refs = do + format <- Find.getFormat + Find.start format `withFilesInRefs` refs -- cgit v1.2.3