summaryrefslogtreecommitdiff
path: root/Command/ExamineKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-11 20:43:45 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-11 20:43:45 -0400
commitd49e9f6a744c490cf4374039fde26c0eb57dc675 (patch)
tree8309f1255db293d410145573c0cd831015d6629c /Command/ExamineKey.hs
parentdb0fd46eddd191632d849f425f5db5ab3eed3905 (diff)
converted ContentLocation, ExampleKey, LookupKey
Diffstat (limited to 'Command/ExamineKey.hs')
-rw-r--r--Command/ExamineKey.hs21
1 files changed, 9 insertions, 12 deletions
diff --git a/Command/ExamineKey.hs b/Command/ExamineKey.hs
index e0a1d9747..55f72f71b 100644
--- a/Command/ExamineKey.hs
+++ b/Command/ExamineKey.hs
@@ -11,21 +11,18 @@ import Common.Annex
import Command
import CmdLine.Batch
import qualified Utility.Format
-import Command.Find (FindOptions(..), showFormatted, keyVars)
+import Command.Find (parseFormatOption, showFormatted, keyVars)
import Types.Key
cmd :: Command
-cmd = noCommit $ noMessages $ withOptions [formatOption, jsonOption, batchOption] $
+cmd = noCommit $ noMessages $ withGlobalOptions [jsonOption] $
command "examinekey" SectionPlumbing
"prints information from a key"
- (paramRepeating paramKey) (withParams seek)
+ (paramRepeating paramKey)
+ (batchable run (optional parseFormatOption))
-seek :: CmdParams -> CommandSeek
-seek ps = do
- format <- getFormat
- batchable withKeys (start format) ps
-
-start :: Maybe Utility.Format.Format -> Batchable Key
-start format _ key = do
- showFormatted format (key2file key) (keyVars key)
- stop
+run :: Maybe Utility.Format.Format -> String -> Annex Bool
+run format p = do
+ let k = fromMaybe (error "bad key") $ file2key p
+ showFormatted format (key2file k) (keyVars k)
+ return True