Add plumbing-level lookupkey command.

This commit is contained in:
Joey Hess 2013-12-15 14:02:23 -04:00
parent f0cf4d1861
commit 7d5b25515c
5 changed files with 37 additions and 1 deletions

26
Command/LookupKey.hs Normal file
View file

@ -0,0 +1,26 @@
{- git-annex command
-
- Copyright 2013 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.LookupKey where
import Common.Annex
import Command
import Annex.CatFile
import Types.Key
def :: [Command]
def = [notBareRepo $
command "lookupkey" (paramRepeating paramFile) seek
SectionPlumbing "looks up key used for file"]
seek :: [CommandSeek]
seek = [withStrings start]
start :: String -> CommandStart
start file = do
liftIO . maybe exitFailure (putStrLn . key2file) =<< catKeyFile file
stop