File: checkbox_toppings.py

package info (click to toggle)
python-questionary 2.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 980 kB
  • sloc: python: 3,920; makefile: 66
file content (17 lines) | stat: -rw-r--r-- 492 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import questionary
from examples import custom_style_dope

if __name__ == "__main__":
    toppings = (
        questionary.checkbox(
            "Select toppings",
            choices=["foo", "bar", "bazz"],
            validate=lambda a: (
                True if len(a) > 0 else "You must select at least one topping"
            ),
            style=custom_style_dope,
        ).ask()
        or []
    )

    print(f"Alright let's go mixing some {' and '.join(toppings)} 🤷‍♂️.")