diff options
author | Rich Trott <rtrott@gmail.com> | 2018-09-21 09:46:49 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-09-21 14:14:31 -0700 |
commit | 363570c07d8453c4e66e8cac326ecd1cc8d9fb51 (patch) | |
tree | 7303c3cb9e06af3e4e5c200ee914e71008ec5ba7 /doc | |
parent | b92ce5165f91eec1f312bb9f762357e673f83501 (diff) | |
download | android-node-v8-363570c07d8453c4e66e8cac326ecd1cc8d9fb51.tar.gz android-node-v8-363570c07d8453c4e66e8cac326ecd1cc8d9fb51.tar.bz2 android-node-v8-363570c07d8453c4e66e8cac326ecd1cc8d9fb51.zip |
doc: add links for repl.ReplServer
Add links to the class definition for repl.ReplServer in places where it
would be helpful.
PR-URL: https://github.com/nodejs/node/pull/23005
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/repl.md | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/doc/api/repl.md b/doc/api/repl.md index 2f7100c7e8..98c3f66839 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -14,13 +14,13 @@ const repl = require('repl'); ## Design and Features -The `repl` module exports the `repl.REPLServer` class. While running, instances -of `repl.REPLServer` will accept individual lines of user input, evaluate those -according to a user-defined evaluation function, then output the result. Input -and output may be from `stdin` and `stdout`, respectively, or may be connected -to any Node.js [stream][]. +The `repl` module exports the [`repl.REPLServer`][] class. While running, +instances of [`repl.REPLServer`][] will accept individual lines of user input, +evaluate those according to a user-defined evaluation function, then output the +result. Input and output may be from `stdin` and `stdout`, respectively, or may +be connected to any Node.js [stream][]. -Instances of `repl.REPLServer` support automatic completion of inputs, +Instances of [`repl.REPLServer`][] support automatic completion of inputs, simplistic Emacs-style line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session state, error recovery, and customizable evaluation functions. @@ -69,10 +69,10 @@ The following key combinations in the REPL have these special effects: ### Default Evaluation -By default, all instances of `repl.REPLServer` use an evaluation function that -evaluates JavaScript expressions and provides access to Node.js' built-in +By default, all instances of [`repl.REPLServer`][] use an evaluation function +that evaluates JavaScript expressions and provides access to Node.js' built-in modules. This default behavior can be overridden by passing in an alternative -evaluation function when the `repl.REPLServer` instance is created. +evaluation function when the [`repl.REPLServer`][] instance is created. #### JavaScript Expressions @@ -211,7 +211,7 @@ undefined ### Custom Evaluation Functions -When a new `repl.REPLServer` is created, a custom evaluation function may be +When a new [`repl.REPLServer`][] is created, a custom evaluation function may be provided. This can be used, for instance, to implement fully customized REPL applications. @@ -261,13 +261,13 @@ function isRecoverableError(error) { ### Customizing REPL Output -By default, `repl.REPLServer` instances format output using the +By default, [`repl.REPLServer`][] instances format output using the [`util.inspect()`][] method before writing the output to the provided `Writable` stream (`process.stdout` by default). The `useColors` boolean option can be specified at construction to instruct the default writer to use ANSI style codes to colorize the output from the `util.inspect()` method. -It is possible to fully customize the output of a `repl.REPLServer` instance +It is possible to fully customize the output of a [`repl.REPLServer`][] instance by passing a new function in using the `writer` option on construction. The following example, for instance, simply converts any input text to upper case: @@ -500,7 +500,7 @@ changes: `SIGINT` is received, i.e. `Ctrl+C` is pressed. This cannot be used together with a custom `eval` function. **Default:** `false`. -The `repl.start()` method creates and starts a `repl.REPLServer` instance. +The `repl.start()` method creates and starts a [`repl.REPLServer`][] instance. If `options` is a string, then it specifies the input prompt: @@ -631,6 +631,7 @@ For an example of running a REPL instance over [curl(1)][], see: [`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn [`readline.InterfaceCompleter`]: readline.html#readline_use_of_the_completer_function [`readline.Interface`]: readline.html#readline_class_interface +[`repl.ReplServer`]: #repl_class_replserver [`util.inspect()`]: util.html#util_util_inspect_object_options [curl(1)]: https://curl.haxx.se/docs/manpage.html [stream]: stream.html |