proxy.golang.org : github.com/nao1215/prompt : v0.0.3
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 -
Documentation -
Download -
JSON -
codemeta.json
purl: pkg:golang/github.com/nao1215/prompt@v0.0.3
Published:
Indexed:
Related tag:
v0.0.3
- github.com/davecgh/go-spew v1.1.1
- github.com/mattn/go-colorable v0.1.14
- github.com/mattn/go-isatty v0.0.20
- github.com/mattn/go-tty v0.0.7
- github.com/pmezard/go-difflib v1.0.0
- github.com/stretchr/testify v1.11.1
- golang.org/x/sys v0.36.0
- golang.org/x/term v0.35.0
- gopkg.in/yaml.v3 v3.0.1