From 8a8c7cf6b5ed7fbe924bd8dfa85245583c94e5fd Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 25 Jul 2022 21:08:27 -0700 Subject: [PATCH] tools: add verbose flag to find-inactive-collaborators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/43964 Reviewed-By: Mestery Reviewed-By: Luigi Pinca Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Tobias Nießen Reviewed-By: Darshan Sen --- tools/find-inactive-collaborators.mjs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/find-inactive-collaborators.mjs b/tools/find-inactive-collaborators.mjs index 71a00b970a9732..0787c634a1a4c9 100755 --- a/tools/find-inactive-collaborators.mjs +++ b/tools/find-inactive-collaborators.mjs @@ -7,8 +7,15 @@ import cp from 'node:child_process'; import fs from 'node:fs'; import readline from 'node:readline'; +import { parseArgs } from 'node:util'; -const SINCE = process.argv[2] || '18 months ago'; +const args = parseArgs({ + allowPositionals: true, + options: { verbose: { type: 'boolean', short: 'v' } } +}); + +const verbose = args.values.verbose; +const SINCE = args.positionals[0] || '18 months ago'; async function runGitCommand(cmd, mapFn) { const childProcess = cp.spawn('/bin/sh', ['-c', cmd], { @@ -176,11 +183,12 @@ async function moveCollaboratorToEmeritus(peopleToMove) { // Get list of current collaborators from README.md. const collaborators = await getCollaboratorsFromReadme(); -console.log(`Since ${SINCE}:\n`); -console.log(`* ${authors.size.toLocaleString()} authors have made commits.`); -console.log(`* ${approvingReviewers.size.toLocaleString()} reviewers have approved landed commits.`); -console.log(`* ${collaborators.length.toLocaleString()} collaborators currently in the project.`); - +if (verbose) { + console.log(`Since ${SINCE}:\n`); + console.log(`* ${authors.size.toLocaleString()} authors have made commits.`); + console.log(`* ${approvingReviewers.size.toLocaleString()} reviewers have approved landed commits.`); + console.log(`* ${collaborators.length.toLocaleString()} collaborators currently in the project.`); +} const inactive = collaborators.filter((collaborator) => !authors.has(collaborator.mailmap) && !approvingReviewers.has(collaborator.name)