Skip to content
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

Populate history from external source. #14

Open
piotrmurach opened this issue May 16, 2019 · 2 comments
Open

Populate history from external source. #14

piotrmurach opened this issue May 16, 2019 · 2 comments

Comments

@piotrmurach
Copy link
Owner

@roscom suggested in tty-prompt issue "Secondly, I currently manage the history in a redis cache, outside of rb-readline which is then available to all users. On session start up, the REPL currently populates rb-readline history from the redis cache. That would be a handy feature to be able to do that in your tty-* modules."

@logicminds
Copy link

I too have a REPL and wish to write a history file and load it back when the user restarts the REPL. The ability to pre-populate the history with a file or proc would be a nice addition.

@piotrmurach
Copy link
Owner Author

Hi Corey,

Thanks for using tty-reader and expressing enthusiasm for this feature. I'm currently working on releasing tty-prompt and pastel gems and have more things on my open-source plate to get done. So I'd love it if you could work on this feature and submit PR.

There is already a history file that saves lines in memory. The way I imagine this working is by having an argument in TTY::Reader::History, let's call it source, that would expose some generic APIs for reading and writing. And then have a specific source like TTY::Reader::Source::File that would know how to deal with files loading and retrieval. This way we would pave the way for future extensions like HTTP, DB and other sources. Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants