mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 21:18:42 +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??);
|
||||
}
|
||||
|
||||
for resolution in &resolutions {
|
||||
resolution.print(&opts);
|
||||
}
|
||||
|
||||
uithread.confirm().await?;
|
||||
|
||||
resolutions
|
||||
|
@ -301,9 +297,6 @@ async fn entry() -> Result<()> {
|
|||
|
||||
tokio::spawn(async move {
|
||||
let resolution = await_task(task).await??;
|
||||
|
||||
resolution.print(&opts);
|
||||
|
||||
install(resolution, opts, temp_dir_path, target).await
|
||||
})
|
||||
})
|
||||
|
@ -454,7 +447,7 @@ async fn resolve(
|
|||
fetchers.add(QuickInstall::new(&client, &fetcher_data).await);
|
||||
}
|
||||
|
||||
match fetchers.first_available().await {
|
||||
let resolution = match fetchers.first_available().await {
|
||||
Some(fetcher) => {
|
||||
// Build final metadata
|
||||
let fetcher_target = fetcher.target();
|
||||
|
@ -476,17 +469,21 @@ async fn resolve(
|
|||
install_path.to_path_buf(),
|
||||
)?;
|
||||
|
||||
Ok(Resolution::Fetch {
|
||||
Resolution::Fetch {
|
||||
fetcher,
|
||||
package,
|
||||
crate_name,
|
||||
version,
|
||||
bin_path,
|
||||
bin_files,
|
||||
})
|
||||
}
|
||||
}
|
||||
None => Ok(Resolution::InstallFromSource { package }),
|
||||
}
|
||||
None => Resolution::InstallFromSource { package },
|
||||
};
|
||||
|
||||
resolution.print(&opts);
|
||||
|
||||
Ok(resolution)
|
||||
}
|
||||
|
||||
fn collect_bin_files(
|
||||
|
|
Loading…
Add table
Reference in a new issue