Add --show-skipped (fix #501) (#502)

This commit is contained in:
Roey Darwish Dror
2020-08-21 23:04:36 +03:00
committed by GitHub
parent d48182e6bd
commit 417ca1257a
18 changed files with 73 additions and 54 deletions

View File

@@ -62,8 +62,7 @@ where
debug!("Path {:?} exists", self.as_ref());
Ok(self)
} else {
debug!("Path {:?} doesn't exist", self.as_ref());
Err(SkipStep.into())
Err(SkipStep(format!("Path {:?} doesn't exist", self.as_ref())).into())
}
}
}
@@ -109,8 +108,7 @@ pub fn require<T: AsRef<OsStr> + Debug>(binary_name: T) -> Result<PathBuf> {
}
Err(e) => match e {
which_crate::Error::CannotFindBinaryPath => {
debug!("Cannot find {:?}", &binary_name);
Err(SkipStep.into())
Err(SkipStep(format!("Cannot find {:?} in PATH", &binary_name)).into())
}
_ => {
panic!("Detecting {:?} failed: {}", &binary_name, e);
@@ -120,10 +118,10 @@ pub fn require<T: AsRef<OsStr> + Debug>(binary_name: T) -> Result<PathBuf> {
}
#[allow(dead_code)]
pub fn require_option<T>(option: Option<T>) -> Result<T> {
pub fn require_option<T>(option: Option<T>, cause: String) -> Result<T> {
if let Some(value) = option {
Ok(value)
} else {
Err(SkipStep.into())
Err(SkipStep(cause).into())
}
}