MCPcopy
hub / github.com/treeverse/dvc / validate_args

Method validate_args

dvc/commands/add.py:10–33  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8
9class CmdAdd(CmdBase):
10 def validate_args(self) -> None:
11 from dvc.exceptions import InvalidArgumentError
12
13 args = self.args
14 invalid_opt = None
15
16 if args.to_remote or args.out:
17 message = "{option} can't be used with "
18 message += "--to-remote" if args.to_remote else "--out"
19 if len(args.targets) != 1:
20 invalid_opt = "multiple targets"
21 elif args.glob:
22 invalid_opt = "--glob option"
23 elif args.no_commit:
24 invalid_opt = "--no-commit option"
25 else:
26 message = "{option} can't be used without --to-remote"
27 if args.remote:
28 invalid_opt = "--remote"
29 elif args.remote_jobs:
30 invalid_opt = "--remote-jobs"
31
32 if invalid_opt is not None:
33 raise InvalidArgumentError(message.format(option=invalid_opt))
34
35 def run(self):
36 from dvc.exceptions import DvcException, InvalidArgumentError

Callers 1

runMethod · 0.95

Calls 2

formatMethod · 0.45

Tested by

no test coverage detected