Skip to content

Commit

Permalink
Merge pull request #12924 from othierry/feat/add-repl-options-support
Browse files Browse the repository at this point in the history
feat(core): add options parameter to repl
  • Loading branch information
kamilmysliwiec authored Dec 18, 2023
2 parents a1780ff + 90ad6d6 commit 3ec1cbc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core/repl/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import { ReplContext } from './repl-context';
import { ReplLogger } from './repl-logger';
import { defineDefaultCommandsOnRepl } from './repl-native-commands';

export async function repl(module: Type | DynamicModule) {
import type { ReplOptions } from 'repl';

export async function repl(
module: Type | DynamicModule,
replOptions: ReplOptions = {},
) {
const app = await NestFactory.createApplicationContext(module, {
abortOnError: false,
logger: new ReplLogger(),
Expand All @@ -21,6 +26,7 @@ export async function repl(module: Type | DynamicModule) {
const replServer = _repl.start({
prompt: clc.green('> '),
ignoreUndefined: true,
...replOptions,
});
assignToObject(replServer.context, replContext.globalScope);

Expand Down

0 comments on commit 3ec1cbc

Please sign in to comment.