Source File
message.go
Belonging Package
github.com/reeflective/readline/internal/completion
package completionimport ()// Messages is a list of messages to be displayed// below the input line, above completions. It is// used to show usage and/or error status hints.type Messages struct {messages map[string]bool}func ( *Messages) () {if .messages == nil {.messages = make(map[string]bool)}}// IsEmpty returns true if there are no messages to display.func ( Messages) () bool {// TODO replacement for Action.skipCache - does this need to consider suppressed messages or is this fine?return len(.messages) == 0}// Add adds a message to the list of messages.func ( *Messages) ( string) {.init().messages[] = true}// Get returns the list of messages to display.func ( Messages) () []string {:= make([]string, 0)for := range .messages {= append(, )}sort.Strings()return}// Suppress removes messages matching the given regular expressions from the list of messages.func ( *Messages) ( ...string) error {.init()for , := range {, := regexp.Compile()if != nil {return}for := range .messages {if .MatchString() {delete(.messages, )}}}return nil}// Merge merges the given messages into the current list of messages.func ( *Messages) ( Messages) {if .messages == nil {return}for := range .messages {.Add()}}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |