Skip to content

Commit 3cb79e2

Browse files
authored
Merge pull request #795 from nipype/catch-option-without-field
Adds check to parse_command_line_template to catch options that don't have trailing field
2 parents b2f4e04 + 7d4587f commit 3cb79e2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pydra/compose/shell/builder.py

+3
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,9 @@ def from_type_str(type_str) -> type:
512512
f"Found unknown token {token!r} in command line template: {template}"
513513
)
514514

515+
if option:
516+
raise ValueError(f"Found an option without a field: {option!r}")
517+
515518
remaining_pos = remaining_positions(arguments, len(arguments) + 1, 1)
516519

517520
for argument in arguments:

pydra/compose/shell/tests/test_shell_fields.py

+7
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,13 @@ def test_shell_missing_executable_dynamic():
984984
)
985985

986986

987+
def test_shell_trailing_option_fail():
988+
989+
with pytest.raises(ValueError, match="Found an option without a field"):
990+
991+
shell.define("ls <directory:generic/directory> --unparameterized-option ")
992+
993+
987994
def test_shell_help1():
988995

989996
Shelly = shell.define(

0 commit comments

Comments
 (0)