DEV Community

Cover image for TUI select fn
John Robertson
John Robertson

Posted on

TUI select fn

Alt Text

Those of you familiar with bash's select builtin know that the automated layout of choices is a nice feature. Last week while prototyping some SQL I became frustrated with select, mostly because you must type in a number and then press the Enter key. Remembering the TUI interfaces of the 1980's, I set about writing hkselect, a hotkey driven replacement for select. Here are the main features:

  • Automated layout of choices.
  • Assign item hotkey with &.
  • Automatic hotkey assignment if & is missing.
  • Bind escaped keys to callback functions.
  • Transparently caches layout information and composed labels.

Full project is here

Below is an example bash program with a functioning hotkey TUI that includes callbacks for F1, F2, and F3:

Top comments (0)