Skip to content

Commit

Permalink
doc: document repl persistent history changes
Browse files Browse the repository at this point in the history
PR-URL: #2224
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Chris Dickinson <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
  • Loading branch information
Fishrock123 authored and rvagg committed Aug 3, 2015
1 parent 8295a89 commit 9573011
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions doc/api/repl.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,38 @@ For example, you could add this to your bashrc file:

alias iojs="env NODE_NO_READLINE=1 rlwrap iojs"

### Persistent History

By default, the REPL will persist history between `iojs` REPL sessions by saving
to a `.node_repl_history` file in the user's home directory. This can be
disabled by setting the environment variable `NODE_REPL_HISTORY=""`.

Previously in io.js v2.x, REPL history was controlled by using a
`NODE_REPL_HISTORY_FILE` environment variable, and the history was saved in JSON
format. This variable has now been deprecated, and your REPL history will
automatically be converted to using plain text. The new file will be saved to
either your home directory, or a directory defined by the `NODE_REPL_HISTORY`
variable, as documented below.

### Environment Variable Options

The built-in repl (invoked by running `iojs` or `iojs -i`) may be controlled
via the following environment variables:

- `NODE_REPL_HISTORY_FILE` - if given, must be a path to a user-writable,
user-readable file. When a valid path is given, persistent history support
is enabled: REPL history will persist across `iojs` repl sessions.
- `NODE_REPL_HISTORY_SIZE` - defaults to `1000`. In conjunction with
`NODE_REPL_HISTORY_FILE`, controls how many lines of history will be
persisted. Must be a positive number.
- `NODE_REPL_HISTORY` - When a valid path is given, persistent REPL history
will be saved to the specified file rather than `.node_repl_history` in the
user's home directory. Setting this value to `""` will disable persistent
REPL history.
- `NODE_REPL_HISTORY_SIZE` - defaults to `1000`. Controls how many lines of
history will be persisted if history is available. Must be a positive number.
- `NODE_REPL_MODE` - may be any of `sloppy`, `strict`, or `magic`. Defaults
to `magic`, which will automatically run "strict mode only" statements in
strict mode.

## repl.start(options)

Returns and starts a `REPLServer` instance, that inherits from
[Readline Interface][]. Accepts an "options" Object that takes
Returns and starts a `REPLServer` instance, that inherits from
[Readline Interface][]. Accepts an "options" Object that takes
the following values:

- `prompt` - the prompt and `stream` for all I/O. Defaults to `> `.
Expand Down Expand Up @@ -237,7 +252,6 @@ The following key combinations in the REPL have these special effects:
- `<ctrl>D` - Similar to the `.exit` keyword.
- `<tab>` - Show both global and local(scope) variables


### Customizing Object displays in the REPL

The REPL module internally uses
Expand Down

0 comments on commit 9573011

Please sign in to comment.