Use pkg_fmt from fetcher

This commit is contained in:
Félix Saparelli 2022-02-16 00:19:59 +13:00
parent a12e934940
commit 99e5de0025
4 changed files with 17 additions and 4 deletions

View file

@ -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