Skip to content

Commit 1322332

Browse files
committed
fixed mandatory multi paths
1 parent 63b011b commit 1322332

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

nipype/utils/nipype_cmd.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ def add_options(parser=None, module=None, function=None):
2424
for name, spec in sorted(interface.inputs.traits(transient=None).items()):
2525
desc = "\n".join(interface._get_trait_desc(inputs, name, spec))[len(name)+2:]
2626
args = {}
27-
if spec.is_trait_type(InputMultiPath):
28-
args["nargs"]="*"
27+
2928
if hasattr(spec, "mandatory") and spec.mandatory:
29+
if spec.is_trait_type(InputMultiPath):
30+
args["nargs"]="+"
3031
parser.add_argument(name, help=desc, **args)
3132
else:
33+
if spec.is_trait_type(InputMultiPath):
34+
args["nargs"]="*"
3235
parser.add_argument("--%s"%name, dest=name,
3336
help=desc, **args)
3437
return parser, interface

nipype/utils/tests/test_cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_run_4d_realign_without_arguments(self):
9191
[--start START]
9292
[--time_interp TIME_INTERP]
9393
[--tr_slices TR_SLICES]
94-
[in_file [in_file ...]]
94+
in_file [in_file ...]
9595
tr
9696
nipype_cmd nipype.interfaces.nipy FmriRealign4d: error: too few arguments
9797
""")

0 commit comments

Comments
 (0)