diff options
Diffstat (limited to 'lib/utils/did-you-mean.js')
-rw-r--r-- | lib/utils/did-you-mean.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/utils/did-you-mean.js b/lib/utils/did-you-mean.js index 5e41af67a..98133196e 100644 --- a/lib/utils/did-you-mean.js +++ b/lib/utils/did-you-mean.js @@ -23,10 +23,11 @@ const didYouMean = async (npm, path, scmd) => { const best = [...bestCmd, ...bestRun, ...bestBin] - const suggestion = best.length === 0 ? '' - : best.length === 1 ? `\n\nDid you mean this?\n${best[0]}` + if (best.length === 0) + return '' + + const suggestion = best.length === 1 ? `\n\nDid you mean this?\n${best[0]}` : `\n\nDid you mean one of these?\n${best.slice(0, 3).join('\n')}` - const result = `Unknown command: "${scmd}"${suggestion}` - return result + return suggestion } module.exports = didYouMean |