mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-05 02:16:37 +00:00
Merge pull request #220 from NobodyXu/fix
Forbid --manifest-path to used with batch installation
This commit is contained in:
commit
ef72f851f7
2 changed files with 14 additions and 0 deletions
|
@ -175,6 +175,16 @@ pub enum BinstallError {
|
||||||
help("Remove the `--version req` or simply use `$crate_name`")
|
help("Remove the `--version req` or simply use `$crate_name`")
|
||||||
)]
|
)]
|
||||||
DuplicateVersionReq,
|
DuplicateVersionReq,
|
||||||
|
|
||||||
|
/// This occurs when you specified `--manifest-path` while also
|
||||||
|
/// specifing multiple crates to install.
|
||||||
|
#[error("If you use --manifest-path, then you can only specify one crate to install")]
|
||||||
|
#[diagnostic(
|
||||||
|
severity(error),
|
||||||
|
code(binstall::manifest_path),
|
||||||
|
help("Remove the `--manifest-path` or only specify one `$crate_name`")
|
||||||
|
)]
|
||||||
|
ManifestPathConflictedWithBatchInstallation,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BinstallError {
|
impl BinstallError {
|
||||||
|
@ -202,6 +212,7 @@ impl BinstallError {
|
||||||
VersionMismatch { .. } => 82,
|
VersionMismatch { .. } => 82,
|
||||||
VersionUnavailable { .. } => 83,
|
VersionUnavailable { .. } => 83,
|
||||||
DuplicateVersionReq => 84,
|
DuplicateVersionReq => 84,
|
||||||
|
ManifestPathConflictedWithBatchInstallation => 85,
|
||||||
};
|
};
|
||||||
|
|
||||||
// reserved codes
|
// reserved codes
|
||||||
|
|
|
@ -198,6 +198,9 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
|
||||||
bin_dir: opts.bin_dir.take(),
|
bin_dir: opts.bin_dir.take(),
|
||||||
});
|
});
|
||||||
let crate_names = take(&mut opts.crate_names);
|
let crate_names = take(&mut opts.crate_names);
|
||||||
|
if crate_names.len() > 1 && opts.manifest_path.is_some() {
|
||||||
|
return Err(BinstallError::ManifestPathConflictedWithBatchInstallation.into());
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize reqwest client
|
// Initialize reqwest client
|
||||||
let client = create_reqwest_client(opts.secure, opts.min_tls_version.map(|v| v.into()))?;
|
let client = create_reqwest_client(opts.secure, opts.min_tls_version.map(|v| v.into()))?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue