-
Notifications
You must be signed in to change notification settings - Fork 34
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
Idea: option to behave like read -n nchars
#18
Comments
Oops! Just seen the following lines right now:
I'm closing this issue because your thoughts seems obvious. Anyway i'm curious, was this feature removed because of a deficient implementation? |
I'm perfectly happy re-opening this, and I'd accept a pull req to add the feature back, provided it doesn't break anything else. It was removed because implementing it on top of the builtin If you look at the builtin |
Actually
It seems that Regarding the implementation on top of the builtin I have done it successfully while developing an interactive CLI based on "hit one key and it will do something" as design principle, resulting the following code. Please note this is a quick and dirty implementation, just an example of what I mean.
|
Ok, well, if it doesn't break anything else this lib does, and the code isn't too complicated to manage, and it matches the behavior of read(1), then sure, patch welcome. |
Nice! I would like to start adding some tests before going in the wild. It would be my first time using tap so I will pull first those tests to ask some feedback from you. My thoughts are taking care of how
It's simply an implementation note? It seems logic to use |
Yeah, that sounds good. |
The idea is to implement an option to allow reading n characters rather than waiting for a new line character before executing callback, just like
read(1)
has.@isaacs If you think this could be nice, I can dive by myself through the code and make a pull request.
Regards,
L.
The text was updated successfully, but these errors were encountered: