-
Notifications
You must be signed in to change notification settings - Fork 128
default complete function does not display descriptions #1388
-
Due to some requirement, i have made a default command by overriding the default() function as shown below:
# Default command to be 'run'
def default(self, stmt):
self.onecmd(f"run {stmt.raw}")
Because of this, most of the time users would be invoking 'run' command directly with arguments instead of calling 'run ':
(cmd2) <args>
instead of
(cmd2) run <args>
To autocomplete for the default function i have overriden the completedefault() function:
def completedefault(self, text, line, begidx, endidx):
return run_completer(self, text, line, begidx, endidx)
run_completer() returns a list of cmd2.CompletionItem but i couldn't see the descriptions when i press double <tab>.
May i know if there is a way to make this work?
Beta Was this translation helpful? Give feedback.
All reactions
CompletionItem handling is only present in the argparse tab completion code.
Since default() is not an argparse-decorated command, nor can it be since it's not a do_xxx function, only basic tab completion is supported.
Replies: 2 comments 1 reply
-
@kmvanbrunt This sounds up your alley if you get a chance ...
Beta Was this translation helpful? Give feedback.
All reactions
-
CompletionItem handling is only present in the argparse tab completion code.
Since default() is not an argparse-decorated command, nor can it be since it's not a do_xxx function, only basic tab completion is supported.
Beta Was this translation helpful? Give feedback.
All reactions
-
Understood. Thanks for your reply
Beta Was this translation helpful? Give feedback.