diff options
Diffstat (limited to 'doc/api/repl.md')
-rw-r--r-- | doc/api/repl.md | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/doc/api/repl.md b/doc/api/repl.md index 324b15f385..4ea2e8c906 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -256,13 +256,32 @@ function isRecoverableError(error) { 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. +stream (`process.stdout` by default). The `showProxy` inspection option is set +to true by default and the `colors` option is set to true depending on the +REPL's `useColors` option. -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: +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. + +If the REPL is run as standalone program, it is also possible to change the +REPL's [inspection defaults][`util.inspect()`] from inside the REPL by using the +`inspect.replDefaults` property which mirrors the `defaultOptions` from +[`util.inspect()`][]. + +```console +> util.inspect.replDefaults.compact = false; +false +> [1] +[ + 1 +] +> +``` + +To fully customize the output of a [`repl.REPLServer`][] instance pass in a new +function for the `writer` option on construction. The following example, for +instance, simply converts any input text to upper case: ```js const repl = require('repl'); |