2013-12-15 18:46:29 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2013 Joey Hess <id@joeyh.name>
|
2013-12-15 18:46:29 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.ExamineKey where
|
|
|
|
|
|
|
|
import Command
|
|
|
|
import qualified Utility.Format
|
2015-07-12 00:43:45 +00:00
|
|
|
import Command.Find (parseFormatOption, showFormatted, keyVars)
|
2013-12-15 18:46:29 +00:00
|
|
|
|
2015-07-08 16:33:27 +00:00
|
|
|
cmd :: Command
|
2016-01-29 17:20:24 +00:00
|
|
|
cmd = noCommit $ noMessages $ withGlobalOptions [jsonOption] $
|
2015-07-08 19:08:02 +00:00
|
|
|
command "examinekey" SectionPlumbing
|
|
|
|
"prints information from a key"
|
2015-07-12 00:43:45 +00:00
|
|
|
(paramRepeating paramKey)
|
|
|
|
(batchable run (optional parseFormatOption))
|
2013-12-15 18:46:29 +00:00
|
|
|
|
2015-07-12 00:43:45 +00:00
|
|
|
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
|