MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / default

Method default

cmd2/cmd2.py:3397–3407  ·  view source on GitHub ↗

Execute when the command given isn't a recognized command implemented by a do_* method. :param statement: Statement object with parsed input

(self, statement: Statement)

Source from the content-addressed store, hash-verified

3395 return stop if stop is not None else False
3396
3397 def default(self, statement: Statement) -> bool | None:
3398 """Execute when the command given isn't a recognized command implemented by a do_* method.
3399
3400 :param statement: Statement object with parsed input
3401 """
3402 err_msg = self.default_error.format(statement.command)
3403 if self.suggest_similar_command and (suggested_command := self._suggest_similar_command(statement.command)):
3404 err_msg += f"\n{self.default_suggestion_message.format(suggested_command)}"
3405
3406 self.perror(err_msg, style=None)
3407 return None
3408
3409 def completedefault(self, *_ignored: Sequence[str]) -> Completions:
3410 """Call to complete an input line when no command-specific complete_*() method is available.

Callers 1

onecmdMethod · 0.95

Calls 2

perrorMethod · 0.95

Tested by

no test coverage detected