8355dba5cc
No behavior changes, but this shows everywhere that a progress meter could be displayed when hashing a file to add to the annex. Many of the places don't make sense to display a progress meter though, eg when importing the copy of the file probably swamps the hashing of the file.
27 lines
647 B
Haskell
27 lines
647 B
Haskell
{- git-annex command
|
|
-
|
|
- Copyright 2016 Joey Hess <id@joeyh.name>
|
|
-
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
|
-}
|
|
|
|
module Command.CalcKey where
|
|
|
|
import Command
|
|
import Backend (genKey)
|
|
import Types.KeySource
|
|
import Utility.Metered
|
|
|
|
cmd :: Command
|
|
cmd = noCommit $ noMessages $ dontCheck repoExists $
|
|
command "calckey" SectionPlumbing
|
|
"calulate key for a file"
|
|
(paramRepeating paramFile)
|
|
(batchable run (pure ()))
|
|
|
|
run :: () -> String -> Annex Bool
|
|
run _ file = genKey (KeySource file file Nothing) nullMeterUpdate Nothing >>= \case
|
|
Just (k, _) -> do
|
|
liftIO $ putStrLn $ serializeKey k
|
|
return True
|
|
Nothing -> return False
|