chore: pull CLI git rev and version into about dialog
This commit is contained in:
3 files changed
+32
-4
No files matched your search
@@ -1,5 +1,5 @@
|
||||
const path = require('path');
|
||||
const { spawnAsyncJSONPromise } = require('./spawn-promise');
|
||||
const { spawnAsyncJSONPromise, spawnSync } = require('./spawn-promise');
|
||||
|
||||
const cliPath = async () => path.resolve(__dirname, '..', 'cli', 'boundary');
|
||||
|
||||
@@ -17,5 +17,19 @@ module.exports = {
|
||||
'--output-json-errors'
|
||||
];
|
||||
return spawnAsyncJSONPromise(command);
|
||||
},
|
||||
// Returns JSON-formatted version information from the CLI
|
||||
version: () => {
|
||||
const command = [ '-v' ];
|
||||
const rawOutput = spawnSync(command);
|
||||
let gitRevision = /Git Revision:\s*(?<rev>.*)\n/.exec(rawOutput);
|
||||
let versionNumber = /Version Number:\s*(?<ver>.*)\n/.exec(rawOutput);
|
||||
if (gitRevision) gitRevision = gitRevision.groups.rev;
|
||||
if (versionNumber) versionNumber = versionNumber.groups.ver;
|
||||
const formatted = versionNumber
|
||||
? `CLI Version ${versionNumber}; Git Rev ${gitRevision}`
|
||||
: `CLI Git Rev ${gitRevision}`;
|
||||
return { gitRevision, versionNumber, formatted };
|
||||
return rawOutput;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user