@@ -407,8 +407,8 @@ def parse_command_only(self, rawinput: str) -> Statement:
407407 """Partially parse input into a Statement object.
408408
409409 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.
412412
413413 This method is used by tab completion code and therefore must not
414414 generate an exception if there are unclosed quotes.
@@ -420,8 +420,8 @@ def parse_command_only(self, rawinput: str) -> Statement:
420420 - args
421421
422422 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.
425425 """
426426 # expand shortcuts and aliases
427427 line = self ._expand (rawinput )
@@ -447,13 +447,20 @@ def parse_command_only(self, rawinput: str) -> Statement:
447447 if not command or not args :
448448 args = None
449449
450+ # set multiline
451+ if command in self .multiline_commands :
452+ multiline_command = command
453+ else :
454+ multiline_command = None
455+
450456 # build the statement
451457 # string representation of args must be an empty string instead of
452458 # None for compatibility with standard library cmd
453459 statement = Statement ('' if args is None else args ,
454460 raw = rawinput ,
455461 command = command ,
456462 args = args ,
463+ multiline_command = multiline_command ,
457464 )
458465 return statement
459466
0 commit comments