You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**sandbox**: `boolean` indicating whether to run a REPL in a sandboxed context. Default: `false`.
67
+
-**sandbox**: boolean indicating whether to run a REPL in a sandboxed context. Default: `false`.
68
68
-**timeout**: number of milliseconds to execute a command before terminating execution. Default: `4294967295`.
69
-
-**isTTY**: `boolean` indicating whether the input and output streams should be treated like a TTY (terminal) and whether the REPL should use ANSI/VT100 escape codes when writing to the output stream.
69
+
-**isTTY**: boolean indicating whether the input and output streams should be treated like a TTY (terminal) and whether the REPL should use ANSI/VT100 escape codes when writing to the output stream.
70
70
-**inputPrompt**: input prompt. If the input prompt includes the character sequence `%d`, the input prompt includes line numbers. Default: `'In [%d]: '`.
71
71
-**outputPrompt**: output prompt. If the output prompt includes the character sequence `%d`, the output prompt includes line numbers. Default: `'Out[%d]: '`.
72
72
-**welcome**: welcome message.
73
73
-**padding**: number of empty lines between consecutive commands. Default: `1`.
74
74
-**load**: file path specifying a JavaScript file to load and evaluate line-by-line (e.g., a previous REPL history file).
75
75
-**save**: file path specifying where to save REPL command history.
76
76
-**log**: file path specifying where to save REPL commands and printed output.
77
-
-**quiet**: `boolean` indicating whether log information, confirmation messages, and other possible REPL diagnostics should be silenced. Default: `false`.
77
+
-**quiet**: boolean indicating whether log information, confirmation messages, and other possible REPL diagnostics should be silenced. Default: `false`.
78
+
-**settings**: object specifying REPL settings.
79
+
80
+
The function supports specifying the following settings:
81
+
82
+
-**autoClosePairs**: boolean indicating whether to automatically insert matching brackets, parentheses, and quotes. Default: `true`.
83
+
-**autoDeletePairs**: boolean indicating whether to automatically delete adjacent matching brackets, parentheses, and quotes. Default: `true`.
84
+
-**completionPreviews**: boolean indicating whether to display completion previews for auto-completion. When streams are TTY, the default is `true`; otherwise, the default is `false`.
78
85
79
86
#### REPL.prototype.createContext()
80
87
@@ -289,6 +296,71 @@ repl.clearCommand();
289
296
repl.close();
290
297
```
291
298
299
+
#### REPL.prototype.settings( \[name\[, value]] )
300
+
301
+
Returns REPL settings.
302
+
303
+
```javascript
304
+
var debug =require( '@stdlib/streams/node/debug-sink' );
305
+
306
+
// Create a new REPL:
307
+
var repl =newREPL({
308
+
'output':debug()
309
+
});
310
+
311
+
// ...
312
+
313
+
// Retrieve REPL settings:
314
+
var o =repl.settings();
315
+
316
+
// ...
317
+
318
+
// Close the REPL:
319
+
repl.close();
320
+
```
321
+
322
+
To retrieve the current value for a specific setting, provide a `name` argument.
323
+
324
+
```javascript
325
+
var debug =require( '@stdlib/streams/node/debug-sink' );
326
+
327
+
// Create a new REPL:
328
+
var repl =newREPL({
329
+
'output':debug()
330
+
});
331
+
332
+
// ...
333
+
334
+
// Retrieve current setting value:
335
+
var v =repl.settings( 'autoClosePairs' );
336
+
337
+
// ...
338
+
339
+
// Close the REPL:
340
+
repl.close();
341
+
```
342
+
343
+
To update a specific setting, provide a `value` argument.
344
+
345
+
```javascript
346
+
var debug =require( '@stdlib/streams/node/debug-sink' );
347
+
348
+
// Create a new REPL:
349
+
var repl =newREPL({
350
+
'output':debug()
351
+
});
352
+
353
+
// ...
354
+
355
+
// Update setting value:
356
+
repl.settings( 'autoClosePairs', false );
357
+
358
+
// ...
359
+
360
+
// Close the REPL:
361
+
repl.close();
362
+
```
363
+
292
364
#### REPL.prototype.close()
293
365
294
366
Closes a REPL.
@@ -966,6 +1038,26 @@ Stops saving commands to a file path associated with a specified record identifi
966
1038
// TODO
967
1039
```
968
1040
1041
+
#### settings( \[name\[, value]] )
1042
+
1043
+
Displays REPL settings.
1044
+
1045
+
```text
1046
+
In [1]: settings()
1047
+
```
1048
+
1049
+
To retrieve the current value for a specific setting, provide a `name` argument.
1050
+
1051
+
```text
1052
+
In [1]: settings( 'autoClosePairs' )
1053
+
```
1054
+
1055
+
To update a specific setting, provide a `value` argument.
0 commit comments