Closed hinshun closed 2 years ago
This changes the API in a backwards-incompatible way, and therefore I cannot accept this pull request.
If you need to take back control of stdin, you can either close and re-open Liner, or you can use TerminalMode to capture the state before and after NewLiner, and ApplyMode the before to regain control, remembering to ApplyMode the after state before calling liner.Prompt again.
Happy to close the PR, but wondering what part of it is backwards-incompatible? All calls liner.NewLiner()
will continue to work.
You're right that most simple uses will continue to work. However, if anybody assigns NewLiner to a function pointer, the type of liner.NewLiner won't match any more. (Admittedly this is extremely niche and unlikely to affect anybody, but "unlikely" isn't the same as "can't".)
I have a use case where I need to take back control of
os.Stdin
occasionally, so I would like to pass in my ownio.Writer
.