1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const xrefparser_1 = require("xrefparser");
|
4 | const help_1 = require("../help");
|
5 | class 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 | }
|
42 | exports.ParseCommand = ParseCommand;
|
43 |
|
\ | No newline at end of file |