mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-16 15:46:36 +00:00
Use pkg_fmt from fetcher
This commit is contained in:
parent
a12e934940
commit
99e5de0025
4 changed files with 17 additions and 4 deletions
|
@ -5,10 +5,11 @@ use reqwest::Method;
|
|||
use serde::Serialize;
|
||||
|
||||
use super::Data;
|
||||
use crate::{download, remote_exists, Template};
|
||||
use crate::{download, remote_exists, PkgFmt, Template};
|
||||
|
||||
pub struct GhRelease {
|
||||
url: String,
|
||||
pkg_fmt: PkgFmt,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
|
@ -26,6 +27,7 @@ impl super::Fetcher for GhRelease {
|
|||
|
||||
Ok(Box::new(Self {
|
||||
url: ctx.render(&data.meta.pkg_url)?,
|
||||
pkg_fmt: data.meta.pkg_fmt,
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -38,6 +40,10 @@ impl super::Fetcher for GhRelease {
|
|||
info!("Downloading package from: '{}'", self.url);
|
||||
download(&self.url, dst).await
|
||||
}
|
||||
|
||||
fn pkg_fmt(&self) -> PkgFmt {
|
||||
self.pkg_fmt
|
||||
}
|
||||
}
|
||||
|
||||
/// Template for constructing download paths
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue