-
I'm new to Rich and I wondered if there was a way to create an interactive prompt. Either keyboard-driven or fuzzy-matching? I saw #2192 where fuzzy-filtering is implemented (which I'm using for now), but I would like to figure out a way to live-filter the choices I'm looking for something like |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
TLDR: not supported in rich (#392 (comment) & #266 (comment)), but possible with textual (#1843 (comment)) or could be done with However, after looking at a bunch of the rich example apps, it seems like a common workaround is to provide indexing, so you could do something like: choices = ["fix","feat","docs"]
for idx, choice in enumerate(choices):
console.print(f"{idx}. {choice}")
selection = Prompt.ask('Which option?', choices=[*map(str, range(len(choices)))], default="0") Look like: 0. fix
1. feat
2. docs
Which option? [0/1/2] (0): |
Beta Was this translation helpful? Give feedback.
-
With iterfzf you can drop into a terminal and use fzf there quite easily, I'm integrating it with rich just now and it works well:
|
Beta Was this translation helpful? Give feedback.
TLDR: not supported in rich (#392 (comment) & #266 (comment)), but possible with textual (#1843 (comment)) or could be done with
questionary
. This is partially related: #960However, after looking at a bunch of the rich example apps, it seems like a common workaround is to provide indexing, so you could do something like:
Look like:
0. fix 1. feat 2. docs Which option? [0/1/2] (0):