Skip to content

Commit 10f3210

Browse files
committed
chore: use command suggestions only when a subcommand is detected
1 parent bc2940b commit 10f3210

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/entrypoints/_shared.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,16 @@ export async function runCLI(entrypoint: string) {
231231
return errorMessageSplit[1];
232232
})();
233233

234-
const closestMatches = useCommandSuggestions(`${parsed._[0]} ${errorMessageSplit[1]}`);
234+
const closestMatches =
235+
nonexistentType === 'subcommand'
236+
? useCommandSuggestions(`${parsed._[0]} ${errorMessageSplit[1]}`)
237+
: [];
235238

236239
const messageParts = [
237240
chalk.gray(`Nonexistent ${nonexistentType}: ${chalk.whiteBright(nonexistentRepresentation)}`),
238241
];
239242

240-
if (closestMatches.length && nonexistentType === 'subcommand') {
243+
if (closestMatches.length) {
241244
messageParts.push(
242245
chalk.gray(
243246
` Did you mean: ${closestMatches.map((cmd) => chalk.whiteBright(cmd)).join(', ')}?`,

0 commit comments

Comments
 (0)