in src/list-pulls.js [278:311]
function next (reportObject) {
if (reportObject && argv['stats-only']) {
if (argv.json) {
report.repos.push(reportObject);
} else {
simple_report.push(reportObject);
}
}
if (repos.length) {
const repo = repos.shift();
listGitHubPullRequests(repo.repoName, argv['max-age'], argv['hide-user'], argv.short, argv['stats-only'], next);
} else if (argv['stats-only']) { // done
function compareFunc (a, b) { // eslint-disable-line no-inner-declarations
if (a['fresh-count'] < b['fresh-count']) {
return argv['sort-ascending'] ? -1 : 1;
}
if (a['fresh-count'] > b['fresh-count']) {
return argv['sort-ascending'] ? 1 : -1;
}
return 0;
}
if (argv.json) {
report.repos.sort(compareFunc);
console.log(JSON.stringify(report, null, 4));
} else {
simple_report.sort(compareFunc);
simple_report.forEach(function (report) {
console.log(report.repo + ' --> ' + report.message);
});
}
}
}