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
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/repl/README.md
+143Lines changed: 143 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -71,6 +71,7 @@ The function accepts the following `options`:
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
+
-**themes**: table mapping of color themes to load for syntax-highlighting
74
75
-**load**: file path specifying a JavaScript file to load and evaluate line-by-line (e.g., a previous REPL history file).
75
76
-**save**: file path specifying where to save REPL command history.
76
77
-**log**: file path specifying where to save REPL commands and printed output.
@@ -83,6 +84,28 @@ The function supports specifying the following settings:
83
84
-**autoDeletePairs**: boolean indicating whether to automatically delete adjacent matching brackets, parentheses, and quotes. Default: `true`.
84
85
-**autoPage**: boolean indicating whether to automatically page return values having a display size exceeding the visible screen. When streams are TTY, the default is `true`; otherwise, the default is `false`.
85
86
-**completionPreviews**: boolean indicating whether to display completion previews for auto-completion. When streams are TTY, the default is `true`; otherwise, the default is `false`.
87
+
-**syntaxHighlighting**: boolean indicating whether to enable syntax highlighting of the input. When streams are TTY, the default is `true`; otherwise, the default is `false`.
88
+
-**theme**: theme to set upon REPL startup. Default: `default`.
89
+
-**defaultTheme**: default theme to set upon REPL startup. Default: `default`.
90
+
91
+
#### REPL.prototype.viewport()
92
+
93
+
Returns the REPL viewport.
94
+
95
+
```javascript
96
+
var debug =require( '@stdlib/streams/node/debug-sink' );
97
+
98
+
// Create a new REPL:
99
+
var repl =newREPL({
100
+
'output':debug()
101
+
});
102
+
103
+
// Query the REPL viewport:
104
+
var v =repl.viewport();
105
+
106
+
// Close the REPL:
107
+
repl.close();
108
+
```
86
109
87
110
#### REPL.prototype.createContext()
88
111
@@ -176,6 +199,126 @@ repl.clearUserDocs();
176
199
repl.close();
177
200
```
178
201
202
+
#### Repl.prototype.themes()
203
+
204
+
Returns all available themes in the syntax-highlighter.
205
+
206
+
```javascript
207
+
var debug =require( '@stdlib/streams/node/debug-sink' );
208
+
209
+
// Create a new REPL:
210
+
var repl =newREPL({
211
+
'output':debug()
212
+
});
213
+
214
+
// ...
215
+
216
+
// Fetch all available themes:
217
+
repl.themes();
218
+
219
+
// ...
220
+
221
+
// Close the REPL:
222
+
repl.close();
223
+
```
224
+
225
+
#### Repl.prototype.getTheme()
226
+
227
+
Returns all available themes in the syntax-highlighter.
228
+
229
+
```javascript
230
+
var debug =require( '@stdlib/streams/node/debug-sink' );
231
+
232
+
// Create a new REPL:
233
+
var repl =newREPL({
234
+
'output':debug()
235
+
});
236
+
237
+
// ...
238
+
239
+
// Fetch all available themes:
240
+
repl.themes();
241
+
242
+
// ...
243
+
244
+
// Close the REPL:
245
+
repl.close();
246
+
```
247
+
248
+
#### Repl.prototype.addTheme()
249
+
250
+
Adds a color theme to the syntax-highlighter.
251
+
252
+
```javascript
253
+
var debug =require( '@stdlib/streams/node/debug-sink' );
254
+
255
+
// Create a new REPL:
256
+
var repl =newREPL({
257
+
'output':debug()
258
+
});
259
+
260
+
// ...
261
+
262
+
// Add a user-defined theme:
263
+
repl.addTheme( 'myTheme', {
264
+
'keyword':'red',
265
+
'variable':'green'
266
+
267
+
// ...
268
+
});
269
+
270
+
// ...
271
+
272
+
// Close the REPL:
273
+
repl.close();
274
+
```
275
+
276
+
#### Repl.prototype.deleteTheme()
277
+
278
+
Deletes a specified theme from the syntax-highlighter.
279
+
280
+
```javascript
281
+
var debug =require( '@stdlib/streams/node/debug-sink' );
282
+
283
+
// Create a new REPL:
284
+
var repl =newREPL({
285
+
'output':debug()
286
+
});
287
+
288
+
// ...
289
+
290
+
// Delete an existing theme:
291
+
repl.deleteTheme( 'myTheme' );
292
+
293
+
// ...
294
+
295
+
// Close the REPL:
296
+
repl.close();
297
+
```
298
+
299
+
#### Repl.prototype.renameTheme()
300
+
301
+
Renames a specified theme in the syntax-highlighter.
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
+
// Rename an existing theme:
314
+
repl.renameTheme( 'myTheme', 'yourTheme' );
315
+
316
+
// ...
317
+
318
+
// Close the REPL:
319
+
repl.close();
320
+
```
321
+
179
322
#### REPL.prototype.load( fpath, clbk )
180
323
181
324
Loads and evaluates a JavaScript file line-by-line.
0 commit comments