2016-04-20 17:49:42 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
|
|
|
- Copyright 2016 Joey Hess <id@joeyh.name>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.CalcKey where
|
|
|
|
|
|
|
|
import Command
|
|
|
|
import Backend (genKey)
|
|
|
|
import Types.KeySource
|
|
|
|
|
|
|
|
cmd :: Command
|
|
|
|
cmd = noCommit $ noMessages $ dontCheck repoExists $
|
|
|
|
command "calckey" SectionPlumbing
|
2019-01-16 18:16:10 +00:00
|
|
|
"calulate key for a file"
|
2016-04-20 17:49:42 +00:00
|
|
|
(paramRepeating paramFile)
|
|
|
|
(batchable run (pure ()))
|
|
|
|
|
|
|
|
run :: () -> String -> Annex Bool
|
2017-12-05 19:00:50 +00:00
|
|
|
run _ file = genKey (KeySource file file Nothing) Nothing >>= \case
|
|
|
|
Just (k, _) -> do
|
2019-01-14 17:03:35 +00:00
|
|
|
liftIO $ putStrLn $ serializeKey k
|
2017-12-05 19:00:50 +00:00
|
|
|
return True
|
|
|
|
Nothing -> return False
|