summaryrefslogtreecommitdiff
path: root/Command/Move.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/Move.hs')
-rw-r--r--Command/Move.hs21
1 files changed, 14 insertions, 7 deletions
diff --git a/Command/Move.hs b/Command/Move.hs
index bd1490b0c..66a0c1660 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -16,18 +16,25 @@ import qualified Remote
import Annex.UUID
def :: [Command]
-def = [dontCheck toOpt $ dontCheck fromOpt $
- command "move" paramPaths seek
+def = [withOptions options $ command "move" paramPaths seek
"move content of files to/from another repository"]
+fromOption :: Option
+fromOption = fieldOption ['f'] "from" paramRemote "source remote"
+
+toOption :: Option
+toOption = fieldOption ['t'] "to" paramRemote "destination remote"
+
+options :: [Option]
+options = [fromOption, toOption]
+
seek :: [CommandSeek]
-seek = [withFilesInGit $ whenAnnexed $ start True]
+seek = [withField "to" id $ \to -> withField "from" id $ \from ->
+ withFilesInGit $ whenAnnexed $ start to from True]
-start :: Bool -> FilePath -> (Key, Backend) -> CommandStart
-start move file (key, _) = do
+start :: Maybe String -> Maybe String -> Bool -> FilePath -> (Key, Backend) -> CommandStart
+start to from move file (key, _) = do
noAuto
- to <- Annex.getState Annex.toremote
- from <- Annex.getState Annex.fromremote
case (from, to) of
(Nothing, Nothing) -> error "specify either --from or --to"
(Nothing, Just name) -> do