2013-12-15 14:46:29 -04:00
|
|
|
{- git-annex command
|
|
|
|
-
|
2015-01-21 12:50:09 -04:00
|
|
|
- Copyright 2013 Joey Hess <id@joeyh.name>
|
2013-12-15 14:46:29 -04:00
|
|
|
-
|
2019-03-13 15:48:14 -04:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2013-12-15 14:46:29 -04:00
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.ExamineKey where
|
|
|
|
|
|
|
|
import Command
|
|
|
|
import qualified Utility.Format
|
2015-07-11 20:43:45 -04:00
|
|
|
import Command.Find (parseFormatOption, showFormatted, keyVars)
|
2013-12-15 14:46:29 -04:00
|
|
|
|
2015-07-08 12:33:27 -04:00
|
|
|
cmd :: Command
|
2016-09-05 12:26:59 -04:00
|
|
|
cmd = noCommit $ noMessages $ dontCheck repoExists $
|
2018-02-19 14:28:17 -04:00
|
|
|
withGlobalOptions [jsonOptions] $
|
2016-09-05 12:26:59 -04:00
|
|
|
command "examinekey" SectionPlumbing
|
|
|
|
"prints information from a key"
|
|
|
|
(paramRepeating paramKey)
|
|
|
|
(batchable run (optional parseFormatOption))
|
2013-12-15 14:46:29 -04:00
|
|
|
|
2015-07-11 20:43:45 -04:00
|
|
|
run :: Maybe Utility.Format.Format -> String -> Annex Bool
|
|
|
|
run format p = do
|
2019-01-14 13:03:35 -04:00
|
|
|
let k = fromMaybe (giveup "bad key") $ deserializeKey p
|
2019-12-05 11:40:10 -04:00
|
|
|
showFormatted format (serializeKey' k) (keyVars k)
|
2015-07-11 20:43:45 -04:00
|
|
|
return True
|