@hesed/psql 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,7 +26,7 @@ $ npm install -g @hesed/psql
26
26
  $ pg COMMAND
27
27
  running command...
28
28
  $ pg (--version)
29
- @hesed/psql/0.5.0 linux-x64 node-v24.16.0
29
+ @hesed/psql/0.5.1 linux-x64 node-v24.17.0
30
30
  $ pg --help [COMMAND]
31
31
  USAGE
32
32
  $ pg COMMAND
@@ -80,7 +80,7 @@ EXAMPLES
80
80
  $ pg psql auth add -p prod
81
81
  ```
82
82
 
83
- _See code: [src/commands/psql/auth/add.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/auth/add.ts)_
83
+ _See code: [src/commands/psql/auth/add.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/auth/add.ts)_
84
84
 
85
85
  ## `pg psql auth delete`
86
86
 
@@ -105,7 +105,7 @@ EXAMPLES
105
105
  $ pg psql auth delete -p prod
106
106
  ```
107
107
 
108
- _See code: [src/commands/psql/auth/delete.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/auth/delete.ts)_
108
+ _See code: [src/commands/psql/auth/delete.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/auth/delete.ts)_
109
109
 
110
110
  ## `pg psql auth list`
111
111
 
@@ -125,7 +125,7 @@ EXAMPLES
125
125
  $ pg psql auth list
126
126
  ```
127
127
 
128
- _See code: [src/commands/psql/auth/list.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/auth/list.ts)_
128
+ _See code: [src/commands/psql/auth/list.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/auth/list.ts)_
129
129
 
130
130
  ## `pg psql auth profile`
131
131
 
@@ -150,7 +150,7 @@ EXAMPLES
150
150
  $ pg psql auth profile --default test
151
151
  ```
152
152
 
153
- _See code: [src/commands/psql/auth/profile.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/auth/profile.ts)_
153
+ _See code: [src/commands/psql/auth/profile.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/auth/profile.ts)_
154
154
 
155
155
  ## `pg psql auth test`
156
156
 
@@ -175,7 +175,7 @@ EXAMPLES
175
175
  $ pg psql auth test -p prod
176
176
  ```
177
177
 
178
- _See code: [src/commands/psql/auth/test.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/auth/test.ts)_
178
+ _See code: [src/commands/psql/auth/test.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/auth/test.ts)_
179
179
 
180
180
  ## `pg psql auth update`
181
181
 
@@ -207,7 +207,7 @@ EXAMPLES
207
207
  $ pg psql auth update -p test
208
208
  ```
209
209
 
210
- _See code: [src/commands/psql/auth/update.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/auth/update.ts)_
210
+ _See code: [src/commands/psql/auth/update.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/auth/update.ts)_
211
211
 
212
212
  ## `pg psql databases`
213
213
 
@@ -215,11 +215,14 @@ List all databases accessible on the PostgreSQL server
215
215
 
216
216
  ```
217
217
  USAGE
218
- $ pg psql databases [-p <value>]
218
+ $ pg psql databases [--json] [-p <value>]
219
219
 
220
220
  FLAGS
221
221
  -p, --profile=<value> Database profile name from config
222
222
 
223
+ GLOBAL FLAGS
224
+ --json Format output as json.
225
+
223
226
  DESCRIPTION
224
227
  List all databases accessible on the PostgreSQL server
225
228
 
@@ -229,7 +232,7 @@ EXAMPLES
229
232
  $ pg psql databases -p staging
230
233
  ```
231
234
 
232
- _See code: [src/commands/psql/databases.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/databases.ts)_
235
+ _See code: [src/commands/psql/databases.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/databases.ts)_
233
236
 
234
237
  ## `pg psql describe-table TABLE`
235
238
 
@@ -237,7 +240,7 @@ Describe the structure of a PostgreSQL table
237
240
 
238
241
  ```
239
242
  USAGE
240
- $ pg psql describe-table TABLE [--format table|json|toon] [-p <value>]
243
+ $ pg psql describe-table TABLE [--json] [--format table|json|toon] [-p <value>]
241
244
 
242
245
  ARGUMENTS
243
246
  TABLE Table name to describe
@@ -247,6 +250,9 @@ FLAGS
247
250
  --format=<option> [default: table] Output format
248
251
  <options: table|json|toon>
249
252
 
253
+ GLOBAL FLAGS
254
+ --json Format output as json.
255
+
250
256
  DESCRIPTION
251
257
  Describe the structure of a PostgreSQL table
252
258
 
@@ -256,7 +262,7 @@ EXAMPLES
256
262
  $ pg psql describe-table orders --format json -p prod
257
263
  ```
258
264
 
259
- _See code: [src/commands/psql/describe-table.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/describe-table.ts)_
265
+ _See code: [src/commands/psql/describe-table.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/describe-table.ts)_
260
266
 
261
267
  ## `pg psql explain-query QUERY`
262
268
 
@@ -264,7 +270,7 @@ Show the execution plan for a PostgreSQL query
264
270
 
265
271
  ```
266
272
  USAGE
267
- $ pg psql explain-query QUERY [--format table|json|toon] [-p <value>]
273
+ $ pg psql explain-query QUERY [--json] [--format table|json|toon] [-p <value>]
268
274
 
269
275
  ARGUMENTS
270
276
  QUERY SQL query to explain
@@ -274,6 +280,9 @@ FLAGS
274
280
  --format=<option> [default: table] Output format
275
281
  <options: table|json|toon>
276
282
 
283
+ GLOBAL FLAGS
284
+ --json Format output as json.
285
+
277
286
  DESCRIPTION
278
287
  Show the execution plan for a PostgreSQL query
279
288
 
@@ -283,7 +292,7 @@ EXAMPLES
283
292
  $ pg psql explain-query "SELECT * FROM orders JOIN users ON orders.user_id = users.id" --format json
284
293
  ```
285
294
 
286
- _See code: [src/commands/psql/explain-query.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/explain-query.ts)_
295
+ _See code: [src/commands/psql/explain-query.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/explain-query.ts)_
287
296
 
288
297
  ## `pg psql indexes TABLE`
289
298
 
@@ -291,7 +300,7 @@ Show indexes for a PostgreSQL table
291
300
 
292
301
  ```
293
302
  USAGE
294
- $ pg psql indexes TABLE [--format table|json|toon] [-p <value>]
303
+ $ pg psql indexes TABLE [--json] [--format table|json|toon] [-p <value>]
295
304
 
296
305
  ARGUMENTS
297
306
  TABLE Table name to show indexes for
@@ -301,6 +310,9 @@ FLAGS
301
310
  --format=<option> [default: table] Output format
302
311
  <options: table|json|toon>
303
312
 
313
+ GLOBAL FLAGS
314
+ --json Format output as json.
315
+
304
316
  DESCRIPTION
305
317
  Show indexes for a PostgreSQL table
306
318
 
@@ -310,7 +322,7 @@ EXAMPLES
310
322
  $ pg psql indexes orders --format json -p prod
311
323
  ```
312
324
 
313
- _See code: [src/commands/psql/indexes.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/indexes.ts)_
325
+ _See code: [src/commands/psql/indexes.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/indexes.ts)_
314
326
 
315
327
  ## `pg psql query QUERY`
316
328
 
@@ -318,7 +330,7 @@ Execute a SQL query against a PostgreSQL database
318
330
 
319
331
  ```
320
332
  USAGE
321
- $ pg psql query QUERY [--format table|json|csv|toon] [-p <value>] [--skip-confirmation]
333
+ $ pg psql query QUERY [--json] [--format table|json|csv|toon] [-p <value>] [--skip-confirmation]
322
334
 
323
335
  ARGUMENTS
324
336
  QUERY SQL query to execute
@@ -329,6 +341,9 @@ FLAGS
329
341
  <options: table|json|csv|toon>
330
342
  --skip-confirmation Skip confirmation prompt for destructive operations
331
343
 
344
+ GLOBAL FLAGS
345
+ --json Format output as json.
346
+
332
347
  DESCRIPTION
333
348
  Execute a SQL query against a PostgreSQL database
334
349
 
@@ -340,7 +355,7 @@ EXAMPLES
340
355
  $ pg psql query "DELETE FROM sessions" -p prod --skip-confirmation
341
356
  ```
342
357
 
343
- _See code: [src/commands/psql/query.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/query.ts)_
358
+ _See code: [src/commands/psql/query.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/query.ts)_
344
359
 
345
360
  ## `pg psql tables`
346
361
 
@@ -348,11 +363,14 @@ List all tables in the current PostgreSQL database
348
363
 
349
364
  ```
350
365
  USAGE
351
- $ pg psql tables [-p <value>]
366
+ $ pg psql tables [--json] [-p <value>]
352
367
 
353
368
  FLAGS
354
369
  -p, --profile=<value> Database profile name from config
355
370
 
371
+ GLOBAL FLAGS
372
+ --json Format output as json.
373
+
356
374
  DESCRIPTION
357
375
  List all tables in the current PostgreSQL database
358
376
 
@@ -362,5 +380,5 @@ EXAMPLES
362
380
  $ pg psql tables -p local
363
381
  ```
364
382
 
365
- _See code: [src/commands/psql/tables.ts](https://github.com/hesedcasa/psql/blob/v0.5.0/src/commands/psql/tables.ts)_
383
+ _See code: [src/commands/psql/tables.ts](https://github.com/hesedcasa/psql/blob/v0.5.1/src/commands/psql/tables.ts)_
366
384
  <!-- commandsstop -->
@@ -0,0 +1,12 @@
1
+ import { Command } from '@oclif/core';
2
+ export declare abstract class BaseCommand extends Command {
3
+ static enableJsonFlag: boolean;
4
+ jsonEnabled(): boolean;
5
+ protected parse(options?: any, argv?: string[]): Promise<any>;
6
+ protected parseJsonOutput(output?: string): unknown;
7
+ protected toErrorJson(err: unknown): {
8
+ error: string;
9
+ };
10
+ private formatFlagValue;
11
+ private hasFormatFlag;
12
+ }
@@ -0,0 +1,50 @@
1
+ import { Command } from '@oclif/core';
2
+ export class BaseCommand extends Command {
3
+ static enableJsonFlag = true;
4
+ jsonEnabled() {
5
+ const separatorIndex = this.argv.indexOf('--');
6
+ const flagArgs = separatorIndex === -1 ? this.argv : this.argv.slice(0, separatorIndex);
7
+ if (this.hasFormatFlag(flagArgs))
8
+ return this.formatFlagValue(flagArgs) === 'json';
9
+ return flagArgs.includes('--json');
10
+ }
11
+ // oclif sets this.parsed=true only after Parser.parse() returns successfully.
12
+ // When parse() throws (e.g. missing required arg), this.parsed stays false and
13
+ // _run() emits an UnparsedCommand warning. The finally block prevents that.
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ async parse(options, argv) {
16
+ try {
17
+ return await super.parse(options, argv);
18
+ }
19
+ finally {
20
+ this.parsed = true;
21
+ }
22
+ }
23
+ parseJsonOutput(output) {
24
+ if (!output)
25
+ return null;
26
+ try {
27
+ return JSON.parse(output);
28
+ }
29
+ catch {
30
+ return output;
31
+ }
32
+ }
33
+ // oclif's default toErrorJson returns the raw error object which for
34
+ // CLIParseError includes context:this (the full config). Strip it down.
35
+ toErrorJson(err) {
36
+ const message = err instanceof Error ? err.message : String(err);
37
+ return { error: message };
38
+ }
39
+ formatFlagValue(flagArgs) {
40
+ for (const [index, arg] of flagArgs.entries()) {
41
+ if (arg === '--format')
42
+ return flagArgs[index + 1];
43
+ if (arg.startsWith('--format='))
44
+ return arg.slice('--format='.length);
45
+ }
46
+ }
47
+ hasFormatFlag(flagArgs) {
48
+ return flagArgs.some((arg) => arg === '--format' || arg.startsWith('--format='));
49
+ }
50
+ }
@@ -1,9 +1,11 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class PostgresDatabases extends Command {
3
3
  static description: string;
4
+ static enableJsonFlag: boolean;
4
5
  static examples: string[];
5
6
  static flags: {
6
7
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
8
  };
8
- run(): Promise<void>;
9
+ jsonEnabled(): boolean;
10
+ run(): Promise<string[]>;
9
11
  }
@@ -2,19 +2,21 @@ import { Command, Flags } from '@oclif/core';
2
2
  import { closeConnections, listDatabases } from '../../psql/index.js';
3
3
  export default class PostgresDatabases extends Command {
4
4
  static description = 'List all databases accessible on the PostgreSQL server';
5
+ static enableJsonFlag = true;
5
6
  static examples = ['<%= config.bin %> <%= command.id %>', '<%= config.bin %> <%= command.id %> -p staging'];
6
7
  static flags = {
7
8
  profile: Flags.string({ char: 'p', description: 'Database profile name from config', required: false }),
8
9
  };
10
+ jsonEnabled() {
11
+ return true;
12
+ }
9
13
  async run() {
10
14
  const { flags } = await this.parse(PostgresDatabases);
11
15
  const result = await listDatabases(this.config, flags.profile);
12
16
  await closeConnections();
13
17
  if (result.success) {
14
- this.logJson(result.databases);
15
- }
16
- else {
17
- this.error(result.error ?? 'Failed to list databases');
18
+ return result.databases ?? [];
18
19
  }
20
+ this.error(result.error ?? 'Failed to list databases');
19
21
  }
20
22
  }
@@ -1,5 +1,5 @@
1
- import { Command } from '@oclif/core';
2
- export default class PostgresDescribeTable extends Command {
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class PostgresDescribeTable extends BaseCommand {
3
3
  static args: {
4
4
  table: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
@@ -9,5 +9,5 @@ export default class PostgresDescribeTable extends Command {
9
9
  format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  };
12
- run(): Promise<void>;
12
+ run(): Promise<unknown>;
13
13
  }
@@ -1,6 +1,7 @@
1
- import { Args, Command, Flags } from '@oclif/core';
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base-command.js';
2
3
  import { closeConnections, describeTable } from '../../psql/index.js';
3
- export default class PostgresDescribeTable extends Command {
4
+ export default class PostgresDescribeTable extends BaseCommand {
4
5
  static args = {
5
6
  table: Args.string({ description: 'Table name to describe', required: true }),
6
7
  };
@@ -23,9 +24,8 @@ export default class PostgresDescribeTable extends Command {
23
24
  await closeConnections();
24
25
  if (result.success) {
25
26
  this.log(result.result ?? '');
27
+ return result;
26
28
  }
27
- else {
28
- this.error(result.error ?? 'Failed to describe table');
29
- }
29
+ this.error(result.error ?? 'Failed to describe table');
30
30
  }
31
31
  }
@@ -1,5 +1,5 @@
1
- import { Command } from '@oclif/core';
2
- export default class PostgresExplain extends Command {
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class PostgresExplain extends BaseCommand {
3
3
  static args: {
4
4
  query: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
@@ -9,5 +9,5 @@ export default class PostgresExplain extends Command {
9
9
  format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  };
12
- run(): Promise<void>;
12
+ run(): Promise<unknown>;
13
13
  }
@@ -1,6 +1,7 @@
1
- import { Args, Command, Flags } from '@oclif/core';
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base-command.js';
2
3
  import { closeConnections, explainQuery } from '../../psql/index.js';
3
- export default class PostgresExplain extends Command {
4
+ export default class PostgresExplain extends BaseCommand {
4
5
  static args = {
5
6
  query: Args.string({ description: 'SQL query to explain', required: true }),
6
7
  };
@@ -23,9 +24,8 @@ export default class PostgresExplain extends Command {
23
24
  await closeConnections();
24
25
  if (result.success) {
25
26
  this.log(result.result ?? '');
27
+ return result;
26
28
  }
27
- else {
28
- this.error(result.error ?? 'Failed to explain query');
29
- }
29
+ this.error(result.error ?? 'Failed to explain query');
30
30
  }
31
31
  }
@@ -1,5 +1,5 @@
1
- import { Command } from '@oclif/core';
2
- export default class PostgresIndexes extends Command {
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class PostgresIndexes extends BaseCommand {
3
3
  static args: {
4
4
  table: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
@@ -9,5 +9,5 @@ export default class PostgresIndexes extends Command {
9
9
  format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  };
12
- run(): Promise<void>;
12
+ run(): Promise<unknown>;
13
13
  }
@@ -1,6 +1,7 @@
1
- import { Args, Command, Flags } from '@oclif/core';
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base-command.js';
2
3
  import { closeConnections, showIndexes } from '../../psql/index.js';
3
- export default class PostgresIndexes extends Command {
4
+ export default class PostgresIndexes extends BaseCommand {
4
5
  static args = {
5
6
  table: Args.string({ description: 'Table name to show indexes for', required: true }),
6
7
  };
@@ -23,9 +24,8 @@ export default class PostgresIndexes extends Command {
23
24
  await closeConnections();
24
25
  if (result.success) {
25
26
  this.log(result.result ?? '');
27
+ return result;
26
28
  }
27
- else {
28
- this.error(result.error ?? 'Failed to show indexes');
29
- }
29
+ this.error(result.error ?? 'Failed to show indexes');
30
30
  }
31
31
  }
@@ -1,5 +1,5 @@
1
- import { Command } from '@oclif/core';
2
- export default class PostgresQuery extends Command {
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class PostgresQuery extends BaseCommand {
3
3
  static args: {
4
4
  query: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
@@ -10,5 +10,5 @@ export default class PostgresQuery extends Command {
10
10
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
11
  'skip-confirmation': import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
12
  };
13
- run(): Promise<void>;
13
+ run(): Promise<unknown>;
14
14
  }
@@ -1,6 +1,7 @@
1
- import { Args, Command, Flags } from '@oclif/core';
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base-command.js';
2
3
  import { closeConnections, executeQuery } from '../../psql/index.js';
3
- export default class PostgresQuery extends Command {
4
+ export default class PostgresQuery extends BaseCommand {
4
5
  static args = {
5
6
  query: Args.string({ description: 'SQL query to execute', required: true }),
6
7
  };
@@ -31,13 +32,15 @@ export default class PostgresQuery extends Command {
31
32
  // leave stdout as clean, parseable data.
32
33
  if (result.notices)
33
34
  this.logToStderr(result.notices);
35
+ if (this.jsonEnabled())
36
+ return this.parseJsonOutput(result.result);
34
37
  this.log(result.result ?? '');
38
+ return result;
35
39
  }
36
- else if (result.requiresConfirmation) {
40
+ if (result.requiresConfirmation) {
37
41
  this.log(`${result.message ?? 'Destructive operation requires confirmation.'}\nRe-run with --skip-confirmation to proceed.`);
42
+ return result;
38
43
  }
39
- else {
40
- this.error(result.error ?? 'Query failed');
41
- }
44
+ this.error(result.error ?? 'Query failed');
42
45
  }
43
46
  }
@@ -1,9 +1,11 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class PostgresTables extends Command {
3
3
  static description: string;
4
+ static enableJsonFlag: boolean;
4
5
  static examples: string[];
5
6
  static flags: {
6
7
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
8
  };
8
- run(): Promise<void>;
9
+ jsonEnabled(): boolean;
10
+ run(): Promise<string[]>;
9
11
  }
@@ -2,19 +2,21 @@ import { Command, Flags } from '@oclif/core';
2
2
  import { closeConnections, listTables } from '../../psql/index.js';
3
3
  export default class PostgresTables extends Command {
4
4
  static description = 'List all tables in the current PostgreSQL database';
5
+ static enableJsonFlag = true;
5
6
  static examples = ['<%= config.bin %> <%= command.id %>', '<%= config.bin %> <%= command.id %> -p local'];
6
7
  static flags = {
7
8
  profile: Flags.string({ char: 'p', description: 'Database profile name from config', required: false }),
8
9
  };
10
+ jsonEnabled() {
11
+ return true;
12
+ }
9
13
  async run() {
10
14
  const { flags } = await this.parse(PostgresTables);
11
15
  const result = await listTables(this.config, flags.profile);
12
16
  await closeConnections();
13
17
  if (result.success) {
14
- this.logJson(result.tables);
15
- }
16
- else {
17
- this.error(result.error ?? 'Failed to list tables');
18
+ return result.tables ?? [];
18
19
  }
20
+ this.error(result.error ?? 'Failed to list tables');
19
21
  }
20
22
  }
@@ -9,6 +9,13 @@
9
9
  "<%= config.bin %> <%= command.id %> -p staging"
10
10
  ],
11
11
  "flags": {
12
+ "json": {
13
+ "description": "Format output as json.",
14
+ "helpGroup": "GLOBAL",
15
+ "name": "json",
16
+ "allowNo": false,
17
+ "type": "boolean"
18
+ },
12
19
  "profile": {
13
20
  "char": "p",
14
21
  "description": "Database profile name from config",
@@ -26,7 +33,7 @@
26
33
  "pluginName": "@hesed/psql",
27
34
  "pluginType": "core",
28
35
  "strict": true,
29
- "enableJsonFlag": false,
36
+ "enableJsonFlag": true,
30
37
  "isESM": true,
31
38
  "relativePath": [
32
39
  "dist",
@@ -50,6 +57,13 @@
50
57
  "<%= config.bin %> <%= command.id %> orders --format json -p prod"
51
58
  ],
52
59
  "flags": {
60
+ "json": {
61
+ "description": "Format output as json.",
62
+ "helpGroup": "GLOBAL",
63
+ "name": "json",
64
+ "allowNo": false,
65
+ "type": "boolean"
66
+ },
53
67
  "format": {
54
68
  "description": "Output format",
55
69
  "name": "format",
@@ -80,7 +94,7 @@
80
94
  "pluginName": "@hesed/psql",
81
95
  "pluginType": "core",
82
96
  "strict": true,
83
- "enableJsonFlag": false,
97
+ "enableJsonFlag": true,
84
98
  "isESM": true,
85
99
  "relativePath": [
86
100
  "dist",
@@ -104,6 +118,13 @@
104
118
  "<%= config.bin %> <%= command.id %> \"SELECT * FROM orders JOIN users ON orders.user_id = users.id\" --format json"
105
119
  ],
106
120
  "flags": {
121
+ "json": {
122
+ "description": "Format output as json.",
123
+ "helpGroup": "GLOBAL",
124
+ "name": "json",
125
+ "allowNo": false,
126
+ "type": "boolean"
127
+ },
107
128
  "format": {
108
129
  "description": "Output format",
109
130
  "name": "format",
@@ -134,7 +155,7 @@
134
155
  "pluginName": "@hesed/psql",
135
156
  "pluginType": "core",
136
157
  "strict": true,
137
- "enableJsonFlag": false,
158
+ "enableJsonFlag": true,
138
159
  "isESM": true,
139
160
  "relativePath": [
140
161
  "dist",
@@ -158,6 +179,13 @@
158
179
  "<%= config.bin %> <%= command.id %> orders --format json -p prod"
159
180
  ],
160
181
  "flags": {
182
+ "json": {
183
+ "description": "Format output as json.",
184
+ "helpGroup": "GLOBAL",
185
+ "name": "json",
186
+ "allowNo": false,
187
+ "type": "boolean"
188
+ },
161
189
  "format": {
162
190
  "description": "Output format",
163
191
  "name": "format",
@@ -188,7 +216,7 @@
188
216
  "pluginName": "@hesed/psql",
189
217
  "pluginType": "core",
190
218
  "strict": true,
191
- "enableJsonFlag": false,
219
+ "enableJsonFlag": true,
192
220
  "isESM": true,
193
221
  "relativePath": [
194
222
  "dist",
@@ -213,6 +241,13 @@
213
241
  "<%= config.bin %> <%= command.id %> \"DELETE FROM sessions\" -p prod --skip-confirmation"
214
242
  ],
215
243
  "flags": {
244
+ "json": {
245
+ "description": "Format output as json.",
246
+ "helpGroup": "GLOBAL",
247
+ "name": "json",
248
+ "allowNo": false,
249
+ "type": "boolean"
250
+ },
216
251
  "format": {
217
252
  "description": "Output format",
218
253
  "name": "format",
@@ -250,7 +285,7 @@
250
285
  "pluginName": "@hesed/psql",
251
286
  "pluginType": "core",
252
287
  "strict": true,
253
- "enableJsonFlag": false,
288
+ "enableJsonFlag": true,
254
289
  "isESM": true,
255
290
  "relativePath": [
256
291
  "dist",
@@ -268,6 +303,13 @@
268
303
  "<%= config.bin %> <%= command.id %> -p local"
269
304
  ],
270
305
  "flags": {
306
+ "json": {
307
+ "description": "Format output as json.",
308
+ "helpGroup": "GLOBAL",
309
+ "name": "json",
310
+ "allowNo": false,
311
+ "type": "boolean"
312
+ },
271
313
  "profile": {
272
314
  "char": "p",
273
315
  "description": "Database profile name from config",
@@ -285,7 +327,7 @@
285
327
  "pluginName": "@hesed/psql",
286
328
  "pluginType": "core",
287
329
  "strict": true,
288
- "enableJsonFlag": false,
330
+ "enableJsonFlag": true,
289
331
  "isESM": true,
290
332
  "relativePath": [
291
333
  "dist",
@@ -640,5 +682,5 @@
640
682
  ]
641
683
  }
642
684
  },
643
- "version": "0.5.0"
685
+ "version": "0.5.1"
644
686
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hesed/psql",
3
3
  "description": "CLI for PostgreSQL database interaction",
4
- "version": "0.5.0",
4
+ "version": "0.5.1",
5
5
  "author": "Hesed",
6
6
  "bin": {
7
7
  "pg": "./bin/run.js"