Skip to content

Commit a0a5257

Browse files
committed
Made printing shell options optional
1 parent edd9029 commit a0a5257

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

src/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@event-driven-io/pongo-core",
3-
"version": "0.16.0",
3+
"version": "0.16.1",
44
"description": "Pongo - Mongo with strong consistency on top of Postgres",
55
"type": "module",
66
"engines": {

src/packages/pongo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@event-driven-io/pongo",
3-
"version": "0.16.0",
3+
"version": "0.16.1",
44
"description": "Pongo - Mongo with strong consistency on top of Postgres",
55
"type": "module",
66
"scripts": {

src/packages/pongo/src/commandLine/shell.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ const prettifyLogs = (logLevel?: string) => {
108108

109109
const startRepl = async (options: {
110110
logging: {
111+
printOptions: boolean;
111112
logLevel: LogLevel;
112113
logStyle: LogStyle;
113114
};
@@ -118,13 +119,17 @@ const startRepl = async (options: {
118119
};
119120
connectionString: string | undefined;
120121
}) => {
121-
console.log(JSON.stringify(options));
122122
// TODO: This will change when we have proper tracing and logging config
123123
// For now, that's enough
124124
setLogLevel(process.env.DUMBO_LOG_LEVEL ?? options.logging.logLevel);
125125
setLogStyle(process.env.DUMBO_LOG_STYLE ?? options.logging.logStyle);
126126

127-
console.log(chalk.green('Starting Pongo Shell (version: 0.16.0)'));
127+
console.log(chalk.green('Starting Pongo Shell (version: 0.16.1)'));
128+
129+
if (options.logging.printOptions) {
130+
console.log(chalk.green('With Options:'));
131+
console.log(prettyJson(options));
132+
}
128133

129134
const connectionString =
130135
options.connectionString ??
@@ -247,6 +252,7 @@ interface ShellOptions {
247252
logStyle?: string;
248253
logLevel?: string;
249254
prettyLog?: boolean;
255+
printOptions?: boolean;
250256
}
251257

252258
const shellCommand = new Command('shell')
@@ -269,6 +275,7 @@ const shellCommand = new Command('shell')
269275
'-no-migrations, --disable-auto-migrations',
270276
'Disable automatic migrations',
271277
)
278+
.option('-o, --print-options', 'Print shell options')
272279
.option(
273280
'-ll, --log-level <logLevel>',
274281
'Log level: DISABLED, INFO, LOG, WARN, ERROR',
@@ -277,12 +284,12 @@ const shellCommand = new Command('shell')
277284
.option('-ls, --log-style', 'Log style: RAW, PRETTY', 'RAW')
278285
.option('-p, --pretty-log', 'Turn on logging with prettified output')
279286
.action(async (options: ShellOptions) => {
280-
console.log(JSON.stringify(options));
281287
const { collection, database } = options;
282288
const connectionString = options.connectionString;
283289

284290
await startRepl({
285291
logging: {
292+
printOptions: options.printOptions === true,
286293
logStyle: options.prettyLog
287294
? LogStyle.PRETTY
288295
: ((options.logStyle as LogStyle | undefined) ?? LogStyle.RAW),

0 commit comments

Comments
 (0)