mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 04:58:42 +00:00
Support for checking multi-targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
0c83d010b1
commit
603955b848
1 changed files with 15 additions and 9 deletions
24
src/main.rs
24
src/main.rs
|
@ -217,18 +217,24 @@ async fn entry() -> Result<()> {
|
||||||
.join(format!("pkg-{}.{}", opts.name, meta.pkg_fmt));
|
.join(format!("pkg-{}.{}", opts.name, meta.pkg_fmt));
|
||||||
debug!("Using temporary download path: {}", pkg_path.display());
|
debug!("Using temporary download path: {}", pkg_path.display());
|
||||||
|
|
||||||
let fetcher_data = Data {
|
let fetcher_data: Vec<_> = detect_targets()
|
||||||
name: package.name.clone(),
|
.await
|
||||||
target: opts.target.clone(),
|
.into_iter()
|
||||||
version: package.version.clone(),
|
.map(|target| Data {
|
||||||
repo: package.repository.clone(),
|
name: package.name.clone(),
|
||||||
meta: meta.clone(),
|
target: target.into(),
|
||||||
};
|
version: package.version.clone(),
|
||||||
|
repo: package.repository.clone(),
|
||||||
|
meta: meta.clone(),
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
// Try github releases, then quickinstall
|
// Try github releases, then quickinstall
|
||||||
let mut fetchers = MultiFetcher::default();
|
let mut fetchers = MultiFetcher::default();
|
||||||
fetchers.add(GhCrateMeta::new(&fetcher_data).await);
|
for data in &fetcher_data {
|
||||||
fetchers.add(QuickInstall::new(&fetcher_data).await);
|
fetchers.add(GhCrateMeta::new(data).await);
|
||||||
|
fetchers.add(QuickInstall::new(data).await);
|
||||||
|
}
|
||||||
|
|
||||||
match fetchers.first_available().await {
|
match fetchers.first_available().await {
|
||||||
Some(fetcher) => {
|
Some(fetcher) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue