-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Add "did you mean" for bun run scripts that are mistyped
#19493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Updated 11:30 PM PT - May 5th, 2025
✅ @Jarred-Sumner, your commit f9919b0bdd34369aff45a4c64ab2ef55784c22f9 passed in 🧪 To try this PR locally: bunx bun-pr 19493That installs a local version of the PR into your bun-19493 --bun |
|
Do we want to use the |
| &.{ "b", CSI ++ "1m" }, | ||
| &.{ "d", CSI ++ "2m" }, | ||
| &.{ "i", CSI ++ "3m" }, | ||
| &.{ "u", CSI ++ "4m" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you update the doc comment?
|
|
||
| /// Calculate the Jaro-Winkler similarity between two strings. | ||
| /// Returns a value between 0.0 (completely different) and 1.0 (identical). | ||
| fn jaroWinkler(s1: []const u8, s2: []const u8) f64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does Jaro-Winkler compare with Levenshtein?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its better imo
| argv0.len -= extname.len; | ||
| } | ||
|
|
||
| Output.prettyError("\nDid you mean \"{s}\"?\n\n <cyan><d>{s} <r><cyan><u>{s}<r>\n", .{ entry, argv0, entry }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this have the correct output for both bun devv and bun run devv ? and can there be a test for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs a test yeah
What does this PR do?
This adds a "did you mean" suggestion for similarly-named package.json scripts. It only appears for package.json scripts if it finds one that is similarly named. To choose a similarly named command, it uses Jaro-Winkler with a distance of 0.7, which is what clap uses.
How did you verify your code works?
Test