Skip to content

Commit

Permalink
Added SQL global and killing shell with ctrl+c
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed Oct 1, 2024
1 parent 0bd6b23 commit c87e95d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/packages/pongo/src/commandLine/shell.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSONSerializer } from '@event-driven-io/dumbo';
import { JSONSerializer, SQL } from '@event-driven-io/dumbo';
import chalk from 'chalk';
import Table from 'cli-table3';
import { Command } from 'commander';
Expand Down Expand Up @@ -95,12 +95,19 @@ const startRepl = (options: {

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
r.context.db = db;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
r.context.SQL = SQL;

// Intercept REPL output to display results as a table if they are arrays
r.on('exit', async () => {
await teardown();
process.exit();
});

r.on('SIGINT', async () => {
await teardown();
process.exit();
});
};

const teardown = async () => {
Expand Down

0 comments on commit c87e95d

Please sign in to comment.