mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-07 12:40:04 +00:00
Write to .crates.toml
This commit is contained in:
parent
caf6f3930b
commit
1c2d005fd4
6 changed files with 207 additions and 2 deletions
20
src/main.rs
20
src/main.rs
|
@ -201,7 +201,10 @@ async fn entry() -> Result<()> {
|
|||
|
||||
// Initialize REQWESTGLOBALCONFIG
|
||||
REQWESTGLOBALCONFIG
|
||||
.set(ReqwestConfig { secure: opts.secure, min_tls: opts.min_tls_version.map(|v| v.into()) })
|
||||
.set(ReqwestConfig {
|
||||
secure: opts.secure,
|
||||
min_tls: opts.min_tls_version.map(|v| v.into()),
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
// Setup logging
|
||||
|
@ -451,6 +454,21 @@ async fn install_from_package(
|
|||
|
||||
uithread.confirm().await?;
|
||||
|
||||
debug!("Writing .crates.toml");
|
||||
if let Ok(mut ctoml) = metafiles::CratesToml::load().await {
|
||||
ctoml.insert(
|
||||
metafiles::CrateVersionSource {
|
||||
name: opts.name.into(),
|
||||
version: package.version.parse().into_diagnostic()?,
|
||||
source: metafiles::Source::Registry(
|
||||
url::Url::parse("https://github.com/rust-lang/crates.io-index").unwrap(),
|
||||
),
|
||||
},
|
||||
bin_files.iter().map(|bin| bin.base_name.clone()),
|
||||
);
|
||||
ctoml.write().await?;
|
||||
}
|
||||
|
||||
info!("Installing binaries...");
|
||||
block_in_place(|| {
|
||||
for file in &bin_files {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue