Interactive CLI packages – checkboxes & selection
Question:
I am trying to learn more about making some cool CLI interfaces to provide the options for some local scripts. By digging into the source of the yeoman-generator I was able to come across inquirer for Node, which is how I learned that it was possible. (Example of what it looks like below)
Specifically I want to be able to do something like display a list of checkboxes and use some key to select multiple options and then continue.
Is anyone familiar with any packages/modules for other CLI languages that would allow me to do something similar? I like Node, but do not generally use it for scripting. Something in Python, Ruby or Go (I just started playing with Go) would be ideal
Answers:
The package which has been around for many years is called Curses. The modern version package is actually called nCurses, but is still compatible with the original one. Here’s a sample screenshot:
I haven’t tried it with Unicode characters – it should work, and then you can use more fancy characters to mark checkbuttons and such.
Curses is available for Python, Ruby and Go (and C and many other languages!).
I am a bit late to the party, but for anyone looking for such libraries now:
- Go – charmbracelet/bubbletea
- Python – petereon/beaupy
- Shell – charmbracelet/gum
Disclaimer: I am a maintainer of beaupy
I am trying to learn more about making some cool CLI interfaces to provide the options for some local scripts. By digging into the source of the yeoman-generator I was able to come across inquirer for Node, which is how I learned that it was possible. (Example of what it looks like below)
Specifically I want to be able to do something like display a list of checkboxes and use some key to select multiple options and then continue.
Is anyone familiar with any packages/modules for other CLI languages that would allow me to do something similar? I like Node, but do not generally use it for scripting. Something in Python, Ruby or Go (I just started playing with Go) would be ideal
The package which has been around for many years is called Curses. The modern version package is actually called nCurses, but is still compatible with the original one. Here’s a sample screenshot:
I haven’t tried it with Unicode characters – it should work, and then you can use more fancy characters to mark checkbuttons and such.
Curses is available for Python, Ruby and Go (and C and many other languages!).
I am a bit late to the party, but for anyone looking for such libraries now:
- Go – charmbracelet/bubbletea
- Python – petereon/beaupy
- Shell – charmbracelet/gum
Disclaimer: I am a maintainer of beaupy