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:
1901
1901
result = target
1902
1902
return result
1903
1903
1904
- def onecmd (self , statement : Statement ) -> Optional [bool ]:
1904
+ def onecmd (self , statement : Union [ Statement , str ] ) -> Optional [bool ]:
1905
1905
""" This executes the actual do_* method for a command.
1906
1906
1907
1907
If the command provided doesn't exist, then it executes _default() instead.
1908
1908
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
1910
1911
:return: a flag indicating whether the interpretation of commands should stop
1911
1912
"""
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
+
1912
1917
funcname = self ._func_named (statement .command )
1913
1918
if not funcname :
1914
1919
self .default (statement )
You can’t perform that action at this time.
0 commit comments