prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.37k stars 716 forks source link

ConditionalAutoSuggest example #508

Open dhoomakethu opened 7 years ago

dhoomakethu commented 7 years ago

Hello,

Could you please add an example on how to use ConditionalAutoSuggest ?

Sanjay

decentral1se commented 6 years ago

Just for now, there are already examples for how to setup an auto suggester over at:

https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/examples/prompts/auto-suggestion.py

The ConditionalAutoSuggest is an auto suggester that also accepts a Filter. You could just do from prompt_toolkit.filters import has_selection and then pass it in as the second positional argument.