move annex.numcopies parsing into withNumCopies

This commit is contained in:
Joey Hess 2011-09-15 16:24:47 -04:00
parent d036cd590f
commit 456b45b9b3
5 changed files with 16 additions and 25 deletions

View file

@ -9,7 +9,6 @@ module Command.Copy where
import Command
import qualified Command.Move
import Utility
command :: [Command]
command = [repoCommand "copy" paramPaths seek
@ -20,9 +19,7 @@ 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, _) ->
start :: FilePath -> Maybe Int -> CommandStart
start file numcopies = isAnnexed file $ \(key, _) ->
autoCopies key (<) numcopies $
Command.Move.start False file
where
numcopies = readMaybe attr