Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expanded missing command complaints, including 'did you mean' s…
…uggestion
- Loading branch information
1 parent
fcfbf96
commit 925cd1b
Showing
7 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { type PackageScripts } from '@pnpm/types' | ||
import didYouMean, { ReturnTypeEnums } from 'didyoumean2' | ||
|
||
export function buildCommandNotFoundHint (scriptName: string, scripts?: PackageScripts | undefined) { | ||
let hint = `Command "${scriptName}" not found.` | ||
|
||
const nearestCommand = scripts && didYouMean(scriptName, Object.keys(scripts), { | ||
returnType: ReturnTypeEnums.FIRST_CLOSEST_MATCH, | ||
}) | ||
|
||
if (nearestCommand) { | ||
hint += ` Did you mean "pnpm run ${nearestCommand}"` | ||
} | ||
|
||
return hint | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.