File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1901,14 +1901,19 @@ def _func_named(self, arg: str) -> str:
19011901 result = target
19021902 return result
19031903
1904- def onecmd (self , statement : Statement ) -> Optional [bool ]:
1904+ def onecmd (self , statement : Union [ Statement , str ] ) -> Optional [bool ]:
19051905 """ This executes the actual do_* method for a command.
19061906
19071907 If the command provided doesn't exist, then it executes _default() instead.
19081908
1909- :param statement: Command - a parsed command from the input stream
1909+ :param statement: Command - intended to be a Statement instance parsed command from the input stream,
1910+ alternative acceptance of a str is present only for backward compatibility with cmd
19101911 :return: a flag indicating whether the interpretation of commands should stop
19111912 """
1913+ # For backwards compatibility with cmd, allow a str to be passed in
1914+ if not isinstance (statement , Statement ):
1915+ statement = self ._complete_statement (statement )
1916+
19121917 funcname = self ._func_named (statement .command )
19131918 if not funcname :
19141919 self .default (statement )
You can’t perform that action at this time.
0 commit comments