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-09-05 16:26:59 +00:00
|
|
|
cmd = noCommit $ noMessages $ dontCheck repoExists $
|
2018-02-19 18:28:17 +00:00
|
|
|
withGlobalOptions [jsonOptions] $
|
2016-09-05 16:26:59 +00:00
|
|
|
command "examinekey" SectionPlumbing
|
|
|
|
"prints information from a key"
|
|
|
|
(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
|
2016-11-16 01:29:54 +00:00
|
|
|
let k = fromMaybe (giveup "bad key") $ file2key p
|
2015-07-12 00:43:45 +00:00
|
|
|
showFormatted format (key2file k) (keyVars k)
|
|
|
|
return True
|