mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Only suggest subcommands if not a .roc path
This commit is contained in:
parent
3930d117f4
commit
b9981ece1e
1 changed files with 11 additions and 8 deletions
|
@ -578,15 +578,18 @@ pub fn build(
|
||||||
));
|
));
|
||||||
// Add some additional hints if run as `roc [FILENAME]`.
|
// Add some additional hints if run as `roc [FILENAME]`.
|
||||||
if matches.subcommand().is_none() {
|
if matches.subcommand().is_none() {
|
||||||
if let Some(possible_typo) = path.to_str() {
|
match path.to_str() {
|
||||||
if let Some((nearest_command, _)) =
|
Some(possible_typo) if !possible_typo.ends_with(".roc") => {
|
||||||
nearest_match(possible_typo, subcommands)
|
if let Some((nearest_command, _)) =
|
||||||
{
|
nearest_match(possible_typo, subcommands)
|
||||||
error_lines.push(format!(
|
{
|
||||||
"Did you mean to use the {} subcommand?",
|
error_lines.push(format!(
|
||||||
nearest_command
|
"Did you mean to use the {} subcommand?",
|
||||||
));
|
nearest_command
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error_lines.push("You can run `roc help` to see the list of available subcommands and for more information on how to provide a .roc file.".to_string());
|
error_lines.push("You can run `roc help` to see the list of available subcommands and for more information on how to provide a .roc file.".to_string());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue