@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
29 lines • 1.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.versionCommand = void 0;
exports.retrieveVersionInformation = retrieveVersionInformation;
exports.printVersionInformation = printVersionInformation;
const version_1 = require("../../../util/version");
const assert_1 = require("../../../util/assert");
const versionRegex = /^\d+\.\d+\.\d+/m;
async function retrieveVersionInformation(parser) {
const flowr = (0, version_1.flowrVersion)().toString();
const r = await parser.rVersion();
(0, assert_1.guard)(versionRegex.test(flowr), `flowR version ${flowr} does not match the expected format!`);
(0, assert_1.guard)(r === 'unknown' || r === 'none' || versionRegex.test(r), `R version ${r} does not match the expected format!`);
return { flowr: flowr, r: r, engine: parser.name };
}
async function printVersionInformation(output, parser) {
const { flowr, r, engine } = await retrieveVersionInformation(parser);
output.stdout(`Engine: ${engine}`);
output.stdout(` flowR: ${flowr}`);
output.stdout(` R: ${r}`);
}
exports.versionCommand = {
description: 'Prints the version of flowR as well as the current version of R',
aliases: [],
usageExample: ':version',
script: false,
fn: (output, parser) => printVersionInformation(output, parser)
};
//# sourceMappingURL=repl-version.js.map