mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
add pkg-url and pkg-fmt overrides
This commit is contained in:
parent
612d19d0fb
commit
76a7fb00c9
2 changed files with 18 additions and 4 deletions
|
@ -80,7 +80,7 @@ Template variables use the format `{ VAR }` where `VAR` is the name of the varia
|
|||
- `bin` is the name of a specific binary, inferred from the crate configuration
|
||||
- `target` is the rust target name (defaults to your architecture, but can be overridden using the `--target` command line option if required().
|
||||
|
||||
Package format can be overridden on a per-target basis, for example, if your `x86_64-pc-windows-msvc` builds use `zip` archives this can be set via:
|
||||
`pkg-url`, `pkg-fmt` and `bin-path` can be overridden on a per-target basis if required, for example, if your `x86_64-pc-windows-msvc` builds use `zip` archives this could be set via:
|
||||
|
||||
```
|
||||
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
|
||||
|
|
20
src/lib.rs
20
src/lib.rs
|
@ -93,8 +93,14 @@ impl Default for PkgMeta {
|
|||
impl PkgMeta {
|
||||
/// Merge configuration overrides into object
|
||||
pub fn merge(&mut self, pkg_override: &PkgOverride) {
|
||||
if let Some(o) = pkg_override.pkg_fmt {
|
||||
self.pkg_fmt = o;
|
||||
if let Some(o) = &pkg_override.pkg_url {
|
||||
self.pkg_url = o.clone();
|
||||
}
|
||||
if let Some(o) = &pkg_override.pkg_fmt {
|
||||
self.pkg_fmt = *o;
|
||||
}
|
||||
if let Some(o) = &pkg_override.bin_dir {
|
||||
self.bin_dir = o.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,14 +111,22 @@ impl PkgMeta {
|
|||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case", default)]
|
||||
pub struct PkgOverride {
|
||||
/// Format for package downloads
|
||||
/// URL template override for package downloads
|
||||
pub pkg_url: Option<String>,
|
||||
|
||||
/// Format override for package downloads
|
||||
pub pkg_fmt: Option<PkgFmt>,
|
||||
|
||||
/// Path template override for binary files in packages
|
||||
pub bin_dir: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for PkgOverride {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
pkg_url: None,
|
||||
pkg_fmt: None,
|
||||
bin_dir: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue