mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-01 17:50:03 +00:00
Feature: Impl opt-out options (#510)
Fixed #136 * Impl opt-out optioins in binstalk * Replace field `Options::{gh_crate, quickinstall}_fetcher` with `resolver` which can determine order of resolver used. * Add new field `Args::{disable_}strategies` * Add new variant `BinstallError::InvalidStrategies` * Add variant `BinstallError::NoFallbackToCargoInstall` * Add code for supporting strategies in mod entry * Test `--disable-strategies` in `tests.sh` * Test for `--strategies` in `tests.sh` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
89fa5b1769
commit
9e80cf0700
6 changed files with 141 additions and 11 deletions
|
@ -310,6 +310,22 @@ pub enum BinstallError {
|
|||
#[diagnostic(severity(error), code(binstall::SourceFilePath))]
|
||||
EmptySourceFilePath,
|
||||
|
||||
/// Invalid strategies configured.
|
||||
///
|
||||
/// - Code: `binstall::strategies`
|
||||
/// - Exit: 93
|
||||
#[error("Invalid strategies configured: {0}")]
|
||||
#[diagnostic(severity(error), code(binstall::strategies))]
|
||||
InvalidStrategies(&'static &'static str),
|
||||
|
||||
/// Fallback to `cargo-install` is disabled.
|
||||
///
|
||||
/// - Code: `binstall::no_fallback_to_cargo_install`
|
||||
/// - Exit: 94
|
||||
#[error("Fallback to cargo-install is disabled")]
|
||||
#[diagnostic(severity(error), code(binstall::no_fallback_to_cargo_install))]
|
||||
NoFallbackToCargoInstall,
|
||||
|
||||
/// A wrapped error providing the context of which crate the error is about.
|
||||
#[error("for crate {crate_name}")]
|
||||
CrateContext {
|
||||
|
@ -348,6 +364,8 @@ impl BinstallError {
|
|||
DuplicateSourceFilePath { .. } => 90,
|
||||
InvalidSourceFilePath { .. } => 91,
|
||||
EmptySourceFilePath => 92,
|
||||
InvalidStrategies(..) => 93,
|
||||
NoFallbackToCargoInstall => 94,
|
||||
CrateContext { error, .. } => error.exit_number(),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue