summaryrefslogtreecommitdiff
path: root/Command/LookupKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-12-15 14:02:23 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-12-15 14:02:23 -0400
commit3d1b94998a0aff3d08cf8648ae977614412e8138 (patch)
tree1988b7e23d1bf4414cc6717fd010f0e0bb6bac12 /Command/LookupKey.hs
parentd8365c862bd88536c108262f4bfeea450128c119 (diff)
Add plumbing-level lookupkey command.
Diffstat (limited to 'Command/LookupKey.hs')
-rw-r--r--Command/LookupKey.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/Command/LookupKey.hs b/Command/LookupKey.hs
new file mode 100644
index 000000000..7964213fe
--- /dev/null
+++ b/Command/LookupKey.hs
@@ -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