go-ncurses
A Go wrapper for the ncurses library
Introduction
go-ncurses is a Go package that wraps the ncurses library, enabling developers to access powerful terminal handling functions from Go applications. The library provides a bridge between Go’s simplicity and ncurses’ extensive terminal manipulation capabilities.
The package is available on GitHub and is released under the GPL-3.0 license.
Features
The library provides comprehensive access to ncurses functionality:
- Terminal Handling: Full terminal control capabilities through ncurses bindings
- Color Support: Rich color handling for terminal applications
- Cursor Control: Precise cursor positioning and management
- Input Handling: Keyboard and mouse input processing
- Output Management: Efficient screen updates and text rendering
- Text Attributes: Support for bold, underline, reverse, and other text styles
Requirements
The library requires ncurses to be installed on your system, including:
- Header files (for compilation)
- Shared libraries (for runtime)
On most Linux distributions, install ncurses development packages:
# Debian/Ubuntu
sudo apt-get install libncurses-dev
# Fedora/RHEL
sudo dnf install ncurses-devel
Installation
To install go-ncurses, use:
go get seehuhn.de/go/ncurses
Usage
The package includes six example programs (example1.go through example6.go) demonstrating various usage patterns. These examples provide a good starting point for learning the library.
Full documentation is available on pkg.go.dev or through the command line:
go doc seehuhn.de/go/ncurses
Examples
The repository includes several examples showing:
- Basic terminal initialization
- Color usage
- Input handling
- Window management
- Advanced terminal features
Documentation
The source code is available on github.com/seehuhn/go-ncurses.
Source Code
View on GitHub: seehuhn/go-ncurses