UNPKG

1.34 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const xrefparser_1 = require("xrefparser");
4const help_1 = require("../help");
5class ParseCommand {
6 constructor(config) {
7 this.reponame = '';
8 this.config = config;
9 }
10 execute(params) {
11 this.parse(this.reponame);
12 }
13 parse(reponame) {
14 const repo = this.config.getRepo(reponame);
15 const parser = new xrefparser_1.Parser();
16 const xrefdata = parser.parseDir(repo.dir, repo.srcdir);
17 if (xrefdata !== undefined) {
18 this.config.writeRepoData(repo.name, xrefdata);
19 }
20 }
21 validate(params) {
22 const options = params['options'];
23 if (options['help'] === true) {
24 const help = new help_1.Help();
25 help.parseCommand();
26 process.exit(0);
27 }
28 let reponame = options['name'];
29 if (reponame === undefined) {
30 if (this.config.data.current === undefined) {
31 console.error('Error: no repo specified, no current repo');
32 return false;
33 }
34 else {
35 reponame = this.config.data.current;
36 }
37 }
38 this.reponame = reponame;
39 return true;
40 }
41}
42exports.ParseCommand = ParseCommand;
43//# sourceMappingURL=parse.js.map
\No newline at end of file