summaryrefslogtreecommitdiff
path: root/Command/ExamineKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-12-15 14:46:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-12-15 14:52:09 -0400
commit0ca7ec1752419b9245373f5063c7c86e52ef2e9a (patch)
treed368bc5367f5549c75ddbed0bf10407ce66e41f5 /Command/ExamineKey.hs
parent3d1b94998a0aff3d08cf8648ae977614412e8138 (diff)
Add plumbing-level lookupkey examinekey command.
find --format: Added hashdirlower, hashdirmixed, keyname, and mtime format variables.
Diffstat (limited to 'Command/ExamineKey.hs')
-rw-r--r--Command/ExamineKey.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/Command/ExamineKey.hs b/Command/ExamineKey.hs
new file mode 100644
index 000000000..7dfdadd3d
--- /dev/null
+++ b/Command/ExamineKey.hs
@@ -0,0 +1,27 @@
+{- git-annex command
+ -
+ - Copyright 2013 Joey Hess <joey@kitenet.net>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Command.ExamineKey where
+
+import Common.Annex
+import Command
+import qualified Utility.Format
+import Command.Find (formatOption, withFormat, showFormatted, keyVars)
+import Types.Key
+
+def :: [Command]
+def = [noCommit $ noMessages $ withOptions [formatOption] $
+ command "examinekey" (paramRepeating paramKey) seek
+ SectionPlumbing "prints information from a key"]
+
+seek :: [CommandSeek]
+seek = [withFormat $ \f -> withKeys $ start f]
+
+start :: Maybe Utility.Format.Format -> Key -> CommandStart
+start format key = do
+ showFormatted format (key2file key) (keyVars key)
+ stop