-
Notifications
You must be signed in to change notification settings - Fork 372
Replace unmaintained gohxs/readline with latest chzyer/readline #535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The Go library `gohxs/readline` has no commits for past 8 years. It was originally forked from `chzyer/readline`, which continues to be maintained, so switch back to it to ensure continued maintenance and updates. This change necessitated adapting the output filtering mechanism due to API incompatibilities that manifested as errors: rline/rline.go:128:16: l.Inst.Config.Output undefined (type *readline.Config has no field or method Output) rline/rline.go:130:7: cfg.FuncFilterOutput undefined (type *readline.Config has no field or method FuncFilterOutput) Specifically, the `readline.Config` no longer provides direct output fields or filter functions. To address this, implement a `filterWriter` to wrap the standard output stream, ensuring existing output filtering functionality is preserved. Closes: xo#528
CI failed without error messages:
|
I just tested this, it doesn't work with syntax highlighting, which basically makes this a no-go, as I personally made this project for 2 reasons: 1) to have a tool to use for all SQL databases with the |
According to chzyer/readline#116 the capability to syntax highlight was merged into Chyzer's version and that is probably also why the gohxs version seized to be maintained? |
var currentWriter io.WriteCloser | ||
if f != nil { | ||
// Wrap the original stdout with the filter | ||
currentWriter = &filterWriter{writer: l.originalStdout, filter: f} | ||
} else { | ||
// If filter is nil, revert to the original stdout | ||
currentWriter = l.originalStdout | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to write this this way
var currentWriter io.WriteCloser | |
if f != nil { | |
// Wrap the original stdout with the filter | |
currentWriter = &filterWriter{writer: l.originalStdout, filter: f} | |
} else { | |
// If filter is nil, revert to the original stdout | |
currentWriter = l.originalStdout | |
} | |
var currentWriter io.WriteCloser | |
// use original stdout by default | |
currentWriter = l.originalStdout | |
if f != nil { | |
// Wrap the original stdout with the filter | |
currentWriter = &filterWriter{writer: l.originalStdout, filter: f} | |
} |
What to you think?
Thanks @ccoVeille for the suggestion, but based on Ken's comment I think we need to have confirmation on the syntax highlightning issue chzyer/readline#253 before it makes sense to polish the syntax on this change, as otherwise it won't be accepted anyway. |
The Go library
gohxs/readline
has no commits for past 8 years. It was originally forked fromchzyer/readline
, which continues to be maintained, so switch back to it to ensure continued maintenance and updates.This change necessitated adapting the output filtering mechanism due to API incompatibilities that manifested as errors:
Specifically, the
readline.Config
no longer provides direct output fields or filter functions. To address this, implement afilterWriter
to wrap the standard output stream, ensuring existing output filtering functionality is preserved.Closes: #528