kazhala / InquirerPy

:snake: Python port of Inquirer.js (A collection of common interactive command-line user interfaces)
https://inquirerpy.readthedocs.io
MIT License
357 stars 19 forks source link

Feature: Showing keybinding list in prompt #72

Open pykenny opened 9 months ago

pykenny commented 9 months ago

Purpose

Just like some Text-UI applications, it would be useful to provide option to show available keybindings as hint, to tell users how to interact with the question/application.

Conceptual Example

Adds extra line in the output to provide keybinding information about current question. When border is enabled, then the hint can be shown on the bottom border:

? Pick your favourites: (select at least 1)
┌────────────────────────────────────────────────────┐
│  ○ Apple                                           │
│❯ ○ Orange                                          │
│  ○ Pear                                            │
└──────────────[Space]Toggle [Enter]Confirm [q]Exit──┘

Extra lines can be added if terminal width is not enough to show full instructions in single line.