proxy.golang.org : github.com/nao1215/prompt
Package prompt provides a modern, robust terminal prompt library for Go. This library is designed as a replacement for the unmaintained go-prompt library, addressing critical issues like divide-by-zero panics, memory leaks, and limited cross-platform support while providing enhanced functionality. Key Features: Quick Start: The simplest way to create a prompt: Advanced Usage with Completion: Key Bindings: The library supports comprehensive key bindings out of the box: Custom Key Bindings: You can customize key bindings by creating a custom KeyMap: Context Support: Use RunWithContext for timeout or cancellation support: Error Handling: The library provides specific error types for different scenarios: Multi-line Input: The prompt automatically detects and handles multi-line input. When the buffer contains newline characters, arrow keys navigate between lines instead of history, and Home/End keys move to line boundaries instead of buffer boundaries. Thread Safety: Prompt instances are not thread-safe. Each prompt should be used from a single goroutine. However, you can safely cancel a prompt from another goroutine using context cancellation. Resource Management: Always call Close() when done with a prompt to prevent resource leaks: The Close method is safe to call multiple times and should be called even if Run or RunWithContext returns an error. Package prompt provides a library for building powerful interactive terminal prompts. This is a modern replacement for go-prompt with better cross-platform support, simpler API, and built-in color scheme support.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/nao1215/prompt
Keywords:
cli
, command-line
, golang
, interactive
, prompt
, terminal
, vt100
License: MIT
Latest release: 29 days ago
First release: about 1 month ago
Namespace: github.com/nao1215
Stars: 2 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Funding links: https://github.com/sponsors/nao1215
Last synced: 13 days ago