diff options
author | Joey Hess <joey@kitenet.net> | 2014-04-17 18:41:24 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-04-17 18:41:24 -0400 |
commit | e23a4eb3c9e9a6bc39a5a59fe45300e8fdfb0916 (patch) | |
tree | d3a75a3f65edb6f8a02b7ce54553e3a9960fcc34 /Command | |
parent | e9b6c350b15a93d82affadfabca18b3e95840cb1 (diff) |
findref: New command, like find but shows files in a specified git ref.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Find.hs | 6 | ||||
-rw-r--r-- | Command/FindRef.hs | 20 |
2 files changed, 24 insertions, 2 deletions
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 <joey@kitenet.net> + - + - 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 |