mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-22 11:50:02 +00:00
feat: Add more variables for template (#1160)
Fixed #775 - Add dep target-lexicon v0.12.7 - Add `target-{family, arch, libc, vendor}` to `package.metadata.binstall`. For `{universal, universal2}-apple-darwin`, the `target-arch` is set to `universal`. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
181b5293e7
commit
d8419ea5a2
10 changed files with 210 additions and 115 deletions
|
@ -10,6 +10,7 @@ use binstalk_downloader::{
|
|||
use cargo_toml::Error as CargoTomlError;
|
||||
use compact_str::CompactString;
|
||||
use miette::{Diagnostic, Report};
|
||||
use target_lexicon::ParseError as TargetTripleParseError;
|
||||
use thiserror::Error;
|
||||
use tokio::task;
|
||||
use tracing::{error, warn};
|
||||
|
@ -314,6 +315,14 @@ pub enum BinstallError {
|
|||
#[diagnostic(severity(error), code(binstall::gh_api_failure))]
|
||||
GhApiErr(#[source] Box<GhApiError>),
|
||||
|
||||
/// Failed to parse target triple
|
||||
///
|
||||
/// - Code: `binstall::target_triple_parse_error`
|
||||
/// - Exit: 97
|
||||
#[error("Failed to parse target triple: {0}")]
|
||||
#[diagnostic(severity(error), code(binstall::target_triple_parse_error))]
|
||||
TargetTripleParseError(#[source] Box<TargetTripleParseError>),
|
||||
|
||||
/// A wrapped error providing the context of which crate the error is about.
|
||||
#[error(transparent)]
|
||||
#[diagnostic(transparent)]
|
||||
|
@ -348,6 +357,7 @@ impl BinstallError {
|
|||
NoFallbackToCargoInstall => 94,
|
||||
InvalidPkgFmt(..) => 95,
|
||||
GhApiErr(..) => 96,
|
||||
TargetTripleParseError(..) => 97,
|
||||
CrateContext(context) => context.err.exit_number(),
|
||||
};
|
||||
|
||||
|
@ -441,3 +451,9 @@ impl From<GhApiError> for BinstallError {
|
|||
BinstallError::GhApiErr(Box::new(e))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<target_lexicon::ParseError> for BinstallError {
|
||||
fn from(e: target_lexicon::ParseError) -> Self {
|
||||
BinstallError::TargetTripleParseError(Box::new(e))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue