reject batch options combined with non-batch options
Reject combinations of --batch (or --batch-keys) with options like --all or --key or with filenames. Most commands ignored the non-batch items when batch mode was enabled. For some reason, addurl and dropkey both processed first the specified non-batch items, followed by entering batch mode. Changed them to also error out, for consistency. Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
56a12eb84c
commit
835c50966a
19 changed files with 50 additions and 27 deletions
|
@ -77,8 +77,9 @@ batchable handler parser paramdesc = batchseeker <$> batchparser
|
|||
|
||||
batchseeker (opts, NoBatch, params) =
|
||||
mapM_ (\p -> go NoBatch opts (SeekInput [p], p)) params
|
||||
batchseeker (opts, batchmode@(Batch fmt), _) =
|
||||
batchInput fmt (pure . Right) (go batchmode opts)
|
||||
batchseeker (opts, batchmode@(Batch fmt), params) =
|
||||
batchOnly Nothing params $
|
||||
batchInput fmt (pure . Right) (go batchmode opts)
|
||||
|
||||
go batchmode opts (si, p) =
|
||||
unlessM (handler opts si p) $
|
||||
|
@ -209,3 +210,8 @@ batchAnnexed fmt seeker keyaction = do
|
|||
, providedMimeEncoding = Nothing
|
||||
, providedLinkType = Nothing
|
||||
}
|
||||
|
||||
batchOnly :: Maybe KeyOptions -> CmdParams -> Annex () -> Annex ()
|
||||
batchOnly Nothing [] a = a
|
||||
batchOnly _ _ _ = giveup "Cannot combine batch option with file or key options"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue