From 825606760247aa2a5d6fd08f5e66bf763248a85b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 10 Jun 2025 09:57:22 -0300 Subject: find: indicate which letters mismatch capitalization --- src/find.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/find.js b/src/find.js index e7471df9..d5ef400d 100644 --- a/src/find.js +++ b/src/find.js @@ -124,6 +124,25 @@ function oopsNameCapitalizationMismatch(mode, { matchingName, matchedName, }) { + if (matchingName.length === matchedName.length) { + let a = '', b = ''; + for (let i = 0; i < matchingName.length; i++) { + if ( + matchingName[i] === matchedName[i] || + matchingName[i].toLowerCase() !== matchingName[i].toLowerCase() + ) { + a += matchingName[i]; + b += matchedName[i]; + } else { + a += colors.bright(colors.red(matchingName[i])); + b += colors.bright(colors.green(matchedName[i])); + } + } + + matchingName = a; + matchedName = b; + } + return warnOrThrow(mode, `Provided capitalization differs from the matched name. Please resolve:\n` + `- provided: ${matchingName}\n` + -- cgit 1.3.0-6-gf8a5