summaryrefslogtreecommitdiff
path: root/Command/Drop.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-09 15:23:14 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-09 15:23:14 -0400
commit87896574f32be5aa1636facc494faeab34cd0845 (patch)
treee3fe7c3572007aaa29eddd1f6ea2aebc07e40c3c /Command/Drop.hs
parent80603339ea4e8b93ef456e706ca8c4efeef341f8 (diff)
converted copy and move
Got a little tricky..
Diffstat (limited to 'Command/Drop.hs')
-rw-r--r--Command/Drop.hs16
1 files changed, 7 insertions, 9 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs
index 3f4ea1a9d..1c595b6c2 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -19,10 +19,8 @@ import Annex.NumCopies
import Annex.Content
import Annex.Wanted
import Annex.Notification
-import Git.Types (RemoteName)
import qualified Data.Set as S
-import Options.Applicative hiding (command)
cmd :: Command
cmd = command "drop" SectionCommon
@@ -31,9 +29,9 @@ cmd = command "drop" SectionCommon
data DropOptions = DropOptions
{ dropFiles :: CmdParams
- , dropFrom :: Maybe RemoteName
+ , dropFrom :: Maybe (DeferredParse Remote)
, autoMode :: Bool
- , keyOptions :: KeyOptions
+ , keyOptions :: Maybe KeyOptions
}
-- TODO: annexedMatchingOptions
@@ -41,12 +39,12 @@ data DropOptions = DropOptions
optParser :: CmdParamsDesc -> Parser DropOptions
optParser desc = DropOptions
<$> cmdParams desc
- <*> parseDropFromOption
+ <*> optional parseDropFromOption
<*> parseAutoOption
- <*> parseKeyOptions False
+ <*> optional (parseKeyOptions False)
-parseDropFromOption :: Parser (Maybe RemoteName)
-parseDropFromOption = optional $ strOption
+parseDropFromOption :: Parser (DeferredParse Remote)
+parseDropFromOption = parseRemoteOption $ strOption
( long "from" <> short 'f' <> metavar paramRemote
<> help "drop content from a remote"
)
@@ -62,7 +60,7 @@ start o file key = start' o key (Just file)
start' :: DropOptions -> Key -> AssociatedFile -> CommandStart
start' o key afile = do
- from <- Remote.byNameWithUUID (dropFrom o)
+ from <- maybe (pure Nothing) (Just <$$> getParsed) (dropFrom o)
checkDropAuto (autoMode o) from afile key $ \numcopies ->
stopUnless (want from) $
case from of