chore(): start moving some packages to the core directory (#7215)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import meant from "meant"
|
||||
|
||||
export function didYouMean(scmd, commands): string {
|
||||
const bestSimilarity = meant(scmd, commands).map((str) => {
|
||||
return ` ${str}`
|
||||
})
|
||||
|
||||
if (bestSimilarity.length === 0) return ``
|
||||
if (bestSimilarity.length === 1) {
|
||||
return `\nDid you mean this?\n ${bestSimilarity[0]}\n`
|
||||
} else {
|
||||
return (
|
||||
[`\nDid you mean one of these?`]
|
||||
.concat(bestSimilarity.slice(0, 3))
|
||||
.join(`\n`) + `\n`
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user