mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-07 12:40:04 +00:00
Refactor main.rs
: Print resolution in resolve
This simplified `entry`. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
bcb46cd736
commit
119192f8ee
1 changed files with 9 additions and 12 deletions
21
src/main.rs
21
src/main.rs
|
@ -274,10 +274,6 @@ async fn entry() -> Result<()> {
|
||||||
resolutions.push(await_task(task).await??);
|
resolutions.push(await_task(task).await??);
|
||||||
}
|
}
|
||||||
|
|
||||||
for resolution in &resolutions {
|
|
||||||
resolution.print(&opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
uithread.confirm().await?;
|
uithread.confirm().await?;
|
||||||
|
|
||||||
resolutions
|
resolutions
|
||||||
|
@ -301,9 +297,6 @@ async fn entry() -> Result<()> {
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let resolution = await_task(task).await??;
|
let resolution = await_task(task).await??;
|
||||||
|
|
||||||
resolution.print(&opts);
|
|
||||||
|
|
||||||
install(resolution, opts, temp_dir_path, target).await
|
install(resolution, opts, temp_dir_path, target).await
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -454,7 +447,7 @@ async fn resolve(
|
||||||
fetchers.add(QuickInstall::new(&client, &fetcher_data).await);
|
fetchers.add(QuickInstall::new(&client, &fetcher_data).await);
|
||||||
}
|
}
|
||||||
|
|
||||||
match fetchers.first_available().await {
|
let resolution = match fetchers.first_available().await {
|
||||||
Some(fetcher) => {
|
Some(fetcher) => {
|
||||||
// Build final metadata
|
// Build final metadata
|
||||||
let fetcher_target = fetcher.target();
|
let fetcher_target = fetcher.target();
|
||||||
|
@ -476,17 +469,21 @@ async fn resolve(
|
||||||
install_path.to_path_buf(),
|
install_path.to_path_buf(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(Resolution::Fetch {
|
Resolution::Fetch {
|
||||||
fetcher,
|
fetcher,
|
||||||
package,
|
package,
|
||||||
crate_name,
|
crate_name,
|
||||||
version,
|
version,
|
||||||
bin_path,
|
bin_path,
|
||||||
bin_files,
|
bin_files,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
None => Ok(Resolution::InstallFromSource { package }),
|
None => Resolution::InstallFromSource { package },
|
||||||
}
|
};
|
||||||
|
|
||||||
|
resolution.print(&opts);
|
||||||
|
|
||||||
|
Ok(resolution)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_bin_files(
|
fn collect_bin_files(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue