tmpvar / repl.history

persist a node repl's history
MIT License
55 stars 19 forks source link

repl.setupHistory #16

Open tcodes0 opened 4 years ago

tcodes0 commented 4 years ago

I could be wrong but I believe history can be setup using just the repl itself

repl = REPL.start({ .. })

repl.setupHistory(`${process.env.HOME}/.repl_node_history`, err => err && console.log('Repl history error:', err))
tcodes0 commented 4 years ago

So I'm basically asking if this lib still has a point? it does add a .history command but you can do that with repl.registerCommand, something like that.

tybro0103 commented 3 years ago

@Thomazella ahh, it was not obvious to me from the docs that I needed to call repl.setupHistory()... I read in a few places that it was supposed to keep history automatically, so I was continually confused about why it wasn't working. So yeah I just replaced this lib after having used it for a few years with repl.setupHistory(). 😄

sisou commented 3 years ago

repl.setupHistory() was only added in Node v11.10 (https://nodejs.org/api/repl.html#repl_replserver_setuphistory_historypath_callback), so this lib is required if you plan to support older NodeJS version.