File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff 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 :
Original file line number Diff line number Diff 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+
987994def test_shell_help1 ():
988995
989996 Shelly = shell .define (
You can’t perform that action at this time.
0 commit comments