Replies: 2 comments 2 replies
-
Therefore, you'll need to move the |
Beta Was this translation helpful? Give feedback.
1 reply
-
Why not just populate the dictionary when you declare it? fruit_choices = {1:'apple (Fuji)', 2:'orange(Mandarin)', 3:'banana (Chiquita)', 'all':'(show all fruit)'}
def fruit_completer(self) -> List[cmd2.CompletionItem]:
return [cmd2.CompletionItem(item_id, description) for item_id, description in fruit_choices.items()] |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Using an exampple similar to my previous question...
Let's say I have a 'show fruit' command with a completer that produces this when I tab:
When I complete the command and the parser function is called, it gets the ID from the choice provider.
How can I also make the choice descr available to the parser function?
See code below, with my question in the
'show fruit'
function.Beta Was this translation helpful? Give feedback.
All reactions