Lines Matching refs:REPL
1 # REPL chapter
9 The `repl` module provides a Read-Eval-Print-Loop (REPL) implementation that
28 ANSI-styled output, saving and restoring current REPL session state, error
35 The following special commands are supported by all REPL instances:
40 * `.clear`: Resets the REPL `context` to an empty object and clears any
42 * `.exit`: Close the I/O stream, causing the REPL to exit.
44 * `.save`: Save the current REPL session to a file:
46 * `.load`: Load a file into the current REPL session.
65 The following key combinations in the REPL have these special effects:
106 scope. It is possible to expose a variable to the REPL explicitly by assigning
116 Properties in the `context` object appear as local within the REPL:
142 REPL environment when used. For instance, unless otherwise declared as a
159 The REPL uses the [`domain`][] module to catch all uncaught exceptions for that
160 REPL session.
162 This use of the [`domain`][] module in the REPL has these side effects:
165 standalone REPL. Adding a listener for this event in a REPL within
174 // cannot be used in the REPL
226 > await Promise.reject(new Error('REPL await'))
227 Error: REPL await
236 One known limitation of using the `await` keyword in the REPL is that
258 The REPL supports bi-directional reverse-i-search similar to [ZSH][]. It is
275 provided. This can be used, for instance, to implement fully customized REPL
278 The following illustrates a hypothetical example of a REPL that performs
296 At the REPL prompt, pressing <kbd>Enter</kbd> sends the current line of input to
321 ### Customizing REPL output
327 REPL's `useColors` option.
333 If the REPL is run as standalone program, it is also possible to change the
334 REPL's [inspection defaults][`util.inspect()`] from inside the REPL by using the
391 The `'exit'` event is emitted when the REPL is exited either by receiving the
410 The `'reset'` event is emitted when the REPL's context is reset. This occurs
411 whenever the `.clear` command is received as input *unless* the REPL is using
416 This can be used primarily to re-initialize REPL context to some pre-defined
459 to the REPL instance. Such commands are invoked by typing a `.` followed by the
467 The following example shows two new commands added to the REPL instance:
487 The new commands can then be used from within the REPL instance:
503 The `replServer.displayPrompt()` method readies the REPL instance for input
551 Initializes a history log file for the REPL instance. When executing the
552 Node.js binary and using the command-line REPL, a history file is initialized
553 by default. However, this is not the case when creating a REPL
555 with REPL instances programmatically.
591 * `input` {stream.Readable} The `Readable` stream from which REPL input will
593 * `output` {stream.Writable} The `Writable` stream to which REPL output will
604 function should include ANSI color styling to REPL output. If a custom
606 color support on the `output` stream if the REPL instance's `terminal` value
610 creating a new separate context for the REPL instance. The node CLI REPL
646 ## The Node.js REPL
668 Various behaviors of the Node.js REPL can be customized using the following
671 * `NODE_REPL_HISTORY`: When a valid path is given, persistent REPL history
674 disable persistent REPL history. Whitespace will be trimmed from the value.
676 set this variable to one or more spaces to disable persistent REPL history.
685 By default, the Node.js REPL will persist history between `node` REPL sessions
690 ### Using the Node.js REPL with advanced line-editors argument
693 `NODE_NO_READLINE=1`. This will start the main and debugger REPL in canonical
702 ### Starting multiple REPL instances against a single running instance argument
704 It is possible to create and run multiple REPL instances against a single
745 Running this application from the command line will start a REPL on stdin.
746 Other REPL clients may connect through the Unix socket or TCP socket. `telnet`,
750 By starting a REPL from a Unix socket-based server instead of stdin, it is
753 For an example of running a "full-featured" (`terminal`) REPL over
757 For an example of running a REPL instance over [`curl(1)`][], see: