From 652c8237c2a900d32ab12c8f0f38254c35202a3b Mon Sep 17 00:00:00 2001 From: Chris Oakman Date: Mon, 28 Oct 2024 23:53:51 -0500 Subject: [PATCH] GitHub Issue #145 - tweak CLI verbiage only one file is checked or formatted (#148) --- cli.mjs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cli.mjs b/cli.mjs index 6845f67..305ae17 100755 --- a/cli.mjs +++ b/cli.mjs @@ -389,7 +389,11 @@ function processCheckCmd (argv) { if (atLeastOneFilePrinted) printToStdout('') if (allFilesFormatted) { - printToStdout(yocto.green('All ' + sortedFiles.length + ' ' + fileStr(sortedFiles.length) + ' formatted with Standard Clojure Style 👍') + ' ' + formatDuration(scriptDurationMs)) + if (sortedFiles.length === 1) { + printToStdout(yocto.green('1 file formatted with Standard Clojure Style 👍') + ' ' + formatDuration(scriptDurationMs)) + } else { + printToStdout(yocto.green('All ' + sortedFiles.length + ' files formatted with Standard Clojure Style 👍') + ' ' + formatDuration(scriptDurationMs)) + } } else { printToStdout(yocto.green(checkResult.filesThatDidNotRequireFormatting.length + ' ' + fileStr(checkResult.filesThatDidNotRequireFormatting.length) + ' formatted with Standard Clojure Style')) printToStdout(yocto.red(checkResult.filesThatDidRequireFormatting.length + ' ' + fileStr(checkResult.filesThatDidRequireFormatting.length) + ' require formatting')) @@ -433,7 +437,11 @@ function processFixCmdNotStdin (argv) { if (atLeastOneFilePrinted) printToStdout('') if (allFilesFormatted) { - printToStdout(yocto.green('All ' + sortedFiles.length + ' files formatted with Standard Clojure Style 👍') + ' ' + formatDuration(scriptDurationMs)) + if (sortedFiles.length === 1) { + printToStdout(yocto.green('1 file formatted with Standard Clojure Style 👍') + ' ' + formatDuration(scriptDurationMs)) + } else { + printToStdout(yocto.green('All ' + sortedFiles.length + ' files formatted with Standard Clojure Style 👍') + ' ' + formatDuration(scriptDurationMs)) + } } else { printToStdout(yocto.green(numFormattedFiles + ' files formatted with Standard Clojure Style')) printToStdout(yocto.red(formatResult.filesWithErrors.length + ' files with errors'))