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
|
|
|
-
|
2019-03-13 19:48:14 +00:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2013-12-15 18:46:29 +00:00
|
|
|
-}
|
|
|
|
|
|
|
|
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
|
|
|
|
2020-09-14 20:49:33 +00:00
|
|
|
run :: Maybe Utility.Format.Format -> SeekInput -> String -> Annex Bool
|
|
|
|
run format _ p = do
|
2019-01-14 17:03:35 +00:00
|
|
|
let k = fromMaybe (giveup "bad key") $ deserializeKey p
|
2019-12-05 15:40:10 +00:00
|
|
|
showFormatted format (serializeKey' k) (keyVars k)
|
2015-07-12 00:43:45 +00:00
|
|
|
return True
|