Skip to content

Commit

Permalink
only suggest --git flag if scheme is http(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
cardoso committed Aug 28, 2023
1 parent ecf05e4 commit 40dae61
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/bin/cargo/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
}

if let Ok(url) = crate_name.into_url() {
return Err(anyhow!(
"invalid package name: `{url}`
if matches!(url.scheme(), "http" | "https") {
return Err(anyhow!(
"invalid package name: `{url}`
Use `cargo install --git {url}` if you meant to install from a git repository."
)
.into());
)
.into());
}
}
}

Expand Down

0 comments on commit 40dae61

Please sign in to comment.