converted ContentLocation, ExampleKey, LookupKey

This commit is contained in:
Joey Hess 2015-07-11 20:43:45 -04:00
parent c6375a9158
commit fdcb54d4f2
5 changed files with 58 additions and 48 deletions

View file

@ -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