-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Remove --
requirement for roc [FILE]
to allow better messaging
#5425
Conversation
b5baa41
to
3930d11
Compare
crates/cli/src/lib.rs
Outdated
// Add some additional hints if run as `roc [FILENAME]`. | ||
if matches.subcommand().is_none() { | ||
if let Some(possible_typo) = path.to_str() { | ||
if let Some((nearest_command, _)) = |
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.
nit: We may want to skip this message if the possible_typo ends in .roc
.
Also, even more optional, if the distance is large, maybe we should skip the message as well.
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.
Good ideas! I added the .roc
check, but thought I'd be a little more permissive to start when it came to subcommand matching. I included the distance in the return value when I wrote the matching function so it's easy to add additional restrictions later if there are too many false positives. Happy to add it now though if you prefer.
Looks good! Just a nit idea. |
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.
Sounds good
#5388
roc [FILE]
no longer requires--
, to allow for better error messaging (seeforomat
example below). Subcommands are required up front to avoid ambiguity:--
is still required forroc <COMMAND>
:When
roc [FILE]
errors, we provide a hint about a possible misspelled subcommand: