UNPKG

xrefcli

Version:

CLI command for the searching through OpenEdge XREF

52 lines 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const help_1 = require("../help"); class ReposCommand { constructor(config) { this.verbose = false; this.json = false; this.config = config; } execute(params) { const promise = new Promise(resolve => { const numIndent = 2; if (this.json) { if (!this.verbose) { console.log(JSON.stringify(this.config.data.repos.map(repo => repo.name), undefined, numIndent)); } else { console.log(JSON.stringify(this.config.data.repos, undefined, numIndent)); } } else { this.config.data.repos.forEach(repo => { if (!this.verbose) { console.log((repo.name === this.config.data.current ? '*' : '') + repo.name); } else { console.log(`${repo.name}: dir=${repo.dir}` + (repo.srcdir !== undefined ? `, src=${repo.srcdir}` : '')); } }); } resolve(); }); return promise; } validate(params) { const options = params['options']; if (options['help'] === true) { const help = new help_1.Help(); help.reposCommand(); process.exit(0); } if (options['verbose'] === true) { this.verbose = true; } if (options['json'] === true) { this.json = true; } return true; } } exports.ReposCommand = ReposCommand; //# sourceMappingURL=repos.js.map