git-annex/Command/Copy.hs

29 lines
686 B
Haskell
Raw Normal View History

2010-11-27 17:09:22 -04:00
{- git-annex command
-
- Copyright 2010 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.Copy where
import Command
import qualified Command.Move
import Utility
2010-11-27 17:09:22 -04:00
command :: [Command]
2011-09-15 14:33:37 -04:00
command = [repoCommand "copy" paramPaths seek
"copy content of files to/from another repository"]
seek :: [CommandSeek]
seek = [withNumCopies start]
-- A copy is just a move that does not delete the source file.
-- However, --auto mode avoids unnecessary copies.
start :: CommandStartAttrFile
start (file, attr) = isAnnexed file $ \(key, _) ->
autoCopies key (<) numcopies $
Command.Move.start False file
where
numcopies = readMaybe attr