look up --to and --from remote names only once

This will speed up commands like move and drop.
This commit is contained in:
Joey Hess 2012-01-06 04:02:35 -04:00
parent 0a36f92a31
commit df21cbfdd2
10 changed files with 30 additions and 33 deletions

View file

@ -91,9 +91,9 @@ withKeys a params = return $ map (a . parse) params
- a conversion function, and then is passed into the seek action.
- This ensures that the conversion function only runs once.
-}
withField :: String -> (Maybe String -> a) -> (a -> CommandSeek) -> CommandSeek
withField :: String -> (Maybe String -> Annex a) -> (a -> CommandSeek) -> CommandSeek
withField field converter a ps = do
f <- converter <$> Annex.getField field
f <- converter =<< Annex.getField field
a f ps
withNothing :: CommandStart -> CommandSeek