Default without statement #1180
Unanswered
WeibingChen17
asked this question in
Q&A
Replies: 1 comment
-
Never mind, I figured it out from the documentation of cmd2.Statement. I passed the def default(self, statement: cmd2:Statement):
self._search(statement.command_and_args) Or in other way, I passed the def default(self, statement: cmd2:Statement):
self.search(statement.raw) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
I defined a console like this
The command
search
combines all the arguments from the parser, and passes it as a string to a method_search
.This command is most frequently used, so I would like to ignore the command. I am thinking to use
default
to callsearch
method.So I set it up like this:
The module complained that I did not pass
item_name
which is required in the parser.I am thinking to call
_search
directly, like thisHowever, if I only put one keyword, the module waited for me to input the statement, because the first keyword was treated as an unknown command.
I searched around and document (tried to used
onecmd
but had the same issue) and internet, but got no luck.Wondering if we have any solution here. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions