mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-12 23:10:02 +00:00
Refactor and add new enum PkgFmtDecomposed
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
c33f195d5f
commit
bd68613448
3 changed files with 78 additions and 29 deletions
31
src/lib.rs
31
src/lib.rs
|
@ -1,7 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum_macros::{Display, EnumString, EnumVariantNames};
|
||||
|
||||
pub mod drivers;
|
||||
pub use drivers::*;
|
||||
|
@ -18,6 +17,9 @@ pub mod fetchers;
|
|||
mod target;
|
||||
pub use target::*;
|
||||
|
||||
mod fmt;
|
||||
pub use fmt::*;
|
||||
|
||||
/// Default package path template (may be overridden in package Cargo.toml)
|
||||
pub const DEFAULT_PKG_URL: &str =
|
||||
"{ repo }/releases/download/v{ version }/{ name }-{ target }-v{ version }.{ archive-format }";
|
||||
|
@ -25,33 +27,6 @@ pub const DEFAULT_PKG_URL: &str =
|
|||
/// Default binary name template (may be overridden in package Cargo.toml)
|
||||
pub const DEFAULT_BIN_DIR: &str = "{ name }-{ target }-v{ version }/{ bin }{ binary-ext }";
|
||||
|
||||
/// Binary format enumeration
|
||||
#[derive(
|
||||
Debug, Copy, Clone, PartialEq, Serialize, Deserialize, Display, EnumString, EnumVariantNames,
|
||||
)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PkgFmt {
|
||||
/// Download format is TAR (uncompressed)
|
||||
Tar,
|
||||
/// Download format is TGZ (TAR + GZip)
|
||||
Tgz,
|
||||
/// Download format is TAR + XZ
|
||||
Txz,
|
||||
/// Download format is TAR + Zstd
|
||||
Tzstd,
|
||||
/// Download format is Zip
|
||||
Zip,
|
||||
/// Download format is raw / binary
|
||||
Bin,
|
||||
}
|
||||
|
||||
impl Default for PkgFmt {
|
||||
fn default() -> Self {
|
||||
Self::Tgz
|
||||
}
|
||||
}
|
||||
|
||||
/// `binstall` metadata container
|
||||
///
|
||||
/// Required to nest metadata under `package.metadata.binstall`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue