UNPKG

xrefcli

Version:

CLI command for the searching through OpenEdge XREF

50 lines 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const xrefparser_1 = require("xrefparser"); const help_1 = require("../help"); class ParseCommand { constructor(config) { this.reponame = ''; this.config = config; } execute(params) { const promise = new Promise(resolve => { this.parse(this.reponame); resolve(); }); return promise; } parse(reponame) { const repo = this.config.getRepo(reponame); const t1 = (new Date()).getTime(); const parser = new xrefparser_1.Parser(); const xrefdata = parser.parseDir(repo.dir, repo.srcdir); const t2 = (new Date()).getTime(); if (xrefdata !== undefined) { this.config.writeRepoData(repo.name, xrefdata); } console.log(`elapsed: ${t2 - t1}ms`); } validate(params) { const options = params['options']; if (options['help'] === true) { const help = new help_1.Help(); help.parseCommand(); process.exit(0); } let reponame = options['name']; if (reponame === undefined) { if (this.config.data.current === undefined) { console.error('Error: no repo specified, no current repo'); return false; } else { reponame = this.config.data.current; } } this.reponame = reponame; return true; } } exports.ParseCommand = ParseCommand; //# sourceMappingURL=parse.js.map