diff options
author | Lance Ball <lball@redhat.com> | 2019-02-01 12:49:16 -0500 |
---|---|---|
committer | Lance Ball <lball@redhat.com> | 2019-02-11 14:30:26 -0500 |
commit | 0aa74443d8bdea3c3840dbc3d4bd700b05ca7a4c (patch) | |
tree | 962e4c785ba03f01bf6ba5ad444f14e416c485ec /doc | |
parent | 902c71a9d09bce6b1da4258d1775375f6539bbec (diff) | |
download | android-node-v8-0aa74443d8bdea3c3840dbc3d4bd700b05ca7a4c.tar.gz android-node-v8-0aa74443d8bdea3c3840dbc3d4bd700b05ca7a4c.tar.bz2 android-node-v8-0aa74443d8bdea3c3840dbc3d4bd700b05ca7a4c.zip |
repl: add repl.setupHistory for programmatic repl
Adds a `repl.setupHistory()` instance method so that
programmatic REPLs can also write history to a file.
This change also refactors all of the history file
management to `lib/internal/repl/history.js`, cleaning
up and simplifying `lib/internal/repl.js`.
PR-URL: https://github.com/nodejs/node/pull/25895
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/repl.md | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/api/repl.md b/doc/api/repl.md index 60adbf641d..4395193de2 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -448,6 +448,22 @@ deprecated: v9.0.0 An internal method used to parse and execute `REPLServer` keywords. Returns `true` if `keyword` is a valid keyword, otherwise `false`. +### replServer.setupHistory(historyPath, callback) +<!-- YAML +added: REPLACEME +--> + +* `historyPath` {string} the path to the history file +* `callback` {Function} called when history writes are ready or upon error + * `err` {Error} + * `repl` {repl.REPLServer} + +Initializes a history log file for the REPL instance. When executing the +Node.js binary and using the command line REPL, a history file is initialized +by default. However, this is not the case when creating a REPL +programmatically. Use this method to initialize a history log file when working +with REPL instances programmatically. + ## repl.start([options]) <!-- YAML added: v0.1.91 |