Uh oh!
There was an error while loading. Please reload this page.
readline: persistent history + repl changes - #596
Conversation
brendanashworth
commented
Jan 24, 2015
Is there a benefit to loading the current history into memory rather than just appending to the as-is history file? From what I'm seeing, it would allow a programmer to access previous history - at the expense of a breaking change to what they might have previously relied on (i.e., first command ran = first index). |
a8m
commented
Jan 24, 2015
Sorry, I didn't get your point. |
brendanashworth
commented
Jan 24, 2015
@a8m its alright. I intended to ask: why load on startup and overwrite the entire file every time a new line is entered, rather than appending each time a new line is entered? For a big file (lets say 10Mb), and someone enters twenty lines, that'd be ~210Mb of input / output rather than just a few bytes (~8Kb) by appending to the file using Edit: this would also allow for two readline's to be run at once with the same history file. |
a8m
commented
Jan 24, 2015
I agree with you @brendanashworth, it really more sense. varrl=readline.createInterface({//...history: 'path/to/history'});rl.setHistorySize(100);what are your thoughts? |
brendanashworth
commented
Jan 24, 2015
@a8m I like that idea, 👍 from me on that topic. On a side note, could you clean up your commit title and description to fit the guidelines? |
f5ee0c9 to
dff142fComparea8m
commented
Jan 25, 2015
Update: Also, I've updated the docs and the tests too. |
There was a problem hiding this comment.
This change should not be made to the REPL module, it should be specific to iojs command line repl.
dff142f to
62b629bComparea8m
commented
Jan 26, 2015
/cc @chrisdickinson |
vkurchatkin
commented
Jan 27, 2015
I don't think |
rvagg
commented
Jan 27, 2015
+1 to @vkurchatkin's comment above |
a8m
commented
Jan 27, 2015
@vkurchatkin writing to the terminal is also io, but I get your point. readline.createInterface({//...history: loadSync('history')}).on('line',// append to a file).on('close',// or save on closing)If this is acceptable to you guys, I'll make this changes. |
vkurchatkin
commented
Jan 27, 2015
@a8m it is, but |
86fb5d8 to
3755b30Comparepiscisaureus
commented
Jan 29, 2015
What @vkurchatkin said. |
a8m
commented
Jan 29, 2015
@piscisaureus this PR was updated after @vkurchatkin comments. |
There was a problem hiding this comment.
it's not clear from the example what is the result of loadHistorySync(). It's better to use array literal
3755b30 to
b577268CompareThere was a problem hiding this comment.
history should be passed here as well
There was a problem hiding this comment.
Right! (I'm usually using it with option object)
changed!
b577268 to
761826cCompare761826c to
b5e62c9CompareThere was a problem hiding this comment.
style: missing semicolon here
brendanashworth
commented
Apr 13, 2015
Is there an update on this? It hasn't been touched in a while. |
a8m
commented
Apr 14, 2015
It's up to you guys. |
silverwind
commented
May 1, 2015
With 0450ce7 landed, I think this may be obsolete now. |
Fishrock123
commented
May 1, 2015
Yep, seems like it. |
As I commented in #343
I think the persistent history support should be part of the
readlinemodule.After this changes, any cli that using
readlinewould be able to support too.e.g:
The "main" changes is in the
readlinemodule and it's tested too.I also changed a bit the
replmodule, and add the history support by default.Maybe it should become with flags(
NODE_DISABLE_HISTORY,NODE_HISTORY_PATH) like @evanlucas suggested, but this is out of the scope of this PR.Thanks.