@@ -407,8 +407,8 @@ def parse_command_only(self, rawinput: str) -> Statement:
407
407
"""Partially parse input into a Statement object.
408
408
409
409
The command is identified, and shortcuts and aliases are expanded.
410
- Terminators, multiline commands, and output redirection are not
411
- parsed.
410
+ Multiline commands are identified, but terminators and output
411
+ redirection are not parsed.
412
412
413
413
This method is used by tab completion code and therefore must not
414
414
generate an exception if there are unclosed quotes.
@@ -420,8 +420,8 @@ def parse_command_only(self, rawinput: str) -> Statement:
420
420
- args
421
421
422
422
Different from parse(), this method does not remove redundant whitespace
423
- within statement.args. It does however, ensure args does not have leading
424
- or trailing whitespace.
423
+ within statement.args. It does however, ensure args does not have
424
+ leading or trailing whitespace.
425
425
"""
426
426
# expand shortcuts and aliases
427
427
line = self ._expand (rawinput )
@@ -447,13 +447,20 @@ def parse_command_only(self, rawinput: str) -> Statement:
447
447
if not command or not args :
448
448
args = None
449
449
450
+ # set multiline
451
+ if command in self .multiline_commands :
452
+ multiline_command = command
453
+ else :
454
+ multiline_command = None
455
+
450
456
# build the statement
451
457
# string representation of args must be an empty string instead of
452
458
# None for compatibility with standard library cmd
453
459
statement = Statement ('' if args is None else args ,
454
460
raw = rawinput ,
455
461
command = command ,
456
462
args = args ,
463
+ multiline_command = multiline_command ,
457
464
)
458
465
return statement
459
466
0 commit comments