gitmyhub

gocui

Go ★ 11k updated 1y ago

Minimalist Go package aimed at creating Console User Interfaces.

Gocui is a minimal Go library for building text-based interfaces that run inside a terminal, letting you create panels, input areas, and keyboard shortcuts in a terminal app the way tools like htop or vim do.

Gosetup: easycomplexity 2/5

Gocui is a Go library for building text-based user interfaces that run inside a terminal window. Instead of building a graphical desktop application, you use gocui to create panels, input areas, and layouts that display as text in a terminal, similar to tools like htop or vim that have their own visual layout inside the command line.

The library is designed to be minimal. You define views, which are the individual rectangular panes that make up your interface, and each view works like a standard Go reader and writer, so you can send text to it and read input from it using familiar patterns. Views can overlap each other, the layout can be changed while the program is running, and the library handles concurrent updates safely.

Other features listed in the README include mouse support, colored text, keyboard bindings that can apply either to the whole application or to a specific view, and an edition mode that can be customized. The library includes example programs in its repository showing common patterns, and full documentation is available on the Go package documentation website.

Installation is a single go get command, as it follows the standard Go package workflow. The README includes a short working example that creates a GUI with one view displaying "Hello world" and a Ctrl+C keybinding to quit.

Gocui is aimed at Go developers who want to add a structured terminal interface to their programs without pulling in a large dependency. The README is brief, and the project does not describe any limitations or known issues beyond what is implied by the feature list.

Where it fits