@ivotoby/postgram-cli 1.30.1 → 1.31.0
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/dist/pgm.js +7 -1
- package/package.json +1 -1
package/dist/pgm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
-
import { createWriteStream } from 'node:fs';
|
|
3
|
+
import { createWriteStream, readFileSync } from 'node:fs';
|
|
4
4
|
import { mkdir, readFile as fsReadFile, stat } from 'node:fs/promises';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { Command } from 'commander';
|
|
@@ -10,6 +10,11 @@ import { handleCliFailure, isJsonMode, parseCommaList, parseJsonObject, printHum
|
|
|
10
10
|
import { AppError, ErrorCode } from './errors.js';
|
|
11
11
|
import { buildSyncManifest } from './sync-walk.js';
|
|
12
12
|
import { compactEdgeResponse, compactEntityListResponse, compactGraphResponse, compactSearchResponse, compactStoredEntityResponse, entityListResponseToToon, graphResponseToToon, searchResponseToToon } from './search-output.js';
|
|
13
|
+
function readCliVersion() {
|
|
14
|
+
const rawPackageJson = readFileSync(new URL('../package.json', import.meta.url), 'utf8');
|
|
15
|
+
const packageJson = JSON.parse(rawPackageJson);
|
|
16
|
+
return packageJson.version;
|
|
17
|
+
}
|
|
13
18
|
function formatStoredEntity(entity) {
|
|
14
19
|
return [
|
|
15
20
|
`${entity.type} ${shortId(entity.id)}${entity.status ? ` [${entity.status}]` : ''}`,
|
|
@@ -239,6 +244,7 @@ const program = new Command();
|
|
|
239
244
|
program
|
|
240
245
|
.name('pgm')
|
|
241
246
|
.description('Postgram human CLI')
|
|
247
|
+
.version(readCliVersion())
|
|
242
248
|
.option('--json', 'emit JSON output');
|
|
243
249
|
program
|
|
244
250
|
.command('store')
|