saghul / txiki.js

A tiny JavaScript runtime
MIT License
2.39k stars 160 forks source link

Function to clear the session memory in repl #582

Open KaruroChori opened 3 days ago

KaruroChori commented 3 days ago

I just noticed there is now persistent memory for past commands in the repl, which is great. It would be nice to have a helper function to also clear its content. \clear only affects the command line. Maybe it is already there and I was not able to find it.

saghul commented 3 days ago

It's not there, I planned to add it later :-P

Do you think a \clear-history command is best, or to drop entries, effectively capping the history size to N?

KaruroChori commented 2 days ago

I think an explicit \clear-history is best. An arbitrary cap without further configuration could be confusing.

There is room for more features thanks to this persistent sqlite storage, like saving a past session as file. Or storing secrets like auth tokens, caching blobs...