pub fn print_error(error: &anyhow::Error) -> crate::Result<()> {
  let mut output = StandardStream::stderr(ColorChoice::Always);
  let _ = output.set_color(ColorSpec::new().set_fg(Some(Color::Red)).set_bold(true));
  write!(output, "error:")?;
  output.reset()?;
  let _ = output.set_color(ColorSpec::new().set_bold(true));
  writeln!(output, " {}", error)?;
  output.reset()?;
  for cause in error.chain().skip(1) {
    writeln!(output, "  Caused by: {}", cause)?;
  }
  // Add Backtrace once its stable.
  // if let Some(backtrace) = error.backtrace() {
  //   writeln!(output, "{:?}", backtrace)?;
  // }
  output.flush()?;
  std::process::exit(1)
}
/// Prints an error to stderr, in the same format that `cargo` uses.
Prints an error to stderr, in the same format that `cargo` uses.
Prints an error to stderr in the same format that ` cargo ` uses .
pub fn print_error(error: &anyhow::Error) -> crate::Result<()> {
  let mut output = StandardStream::stderr(ColorChoice::Always);
  let _ = output.set_color(ColorSpec::new().set_fg(Some(Color::Red)).set_bold(true));
  write!(output, "error:")?;
  output.reset()?;
  let _ = output.set_color(ColorSpec::new().set_bold(true));
  writeln!(output, " {}", error)?;
  output.reset()?;
  for cause in error.chain().skip(1) {
    writeln!(output, "  Caused by: {}", cause)?;
  }
  // Add Backtrace once its stable.
  // if let Some(backtrace) = error.backtrace() {
  //   writeln!(output, "{:?}", backtrace)?;
  // }
  output.flush()?;
  std::process::exit(1)
}
pub fn print_error ( error : & anyhow :: Error ) -> crate :: Result < ( ) > { let mut output = StandardStream :: stderr ( ColorChoice :: Always ) ; let _ = output . set_color ( ColorSpec :: new ( ) . set_fg ( Some ( Color :: Red ) ) . set_bold ( true ) ) ; write ! ( output " " ) ? ; output . reset ( ) ? ; let _ = output . set_color ( ColorSpec :: new ( ) . set_bold ( true ) ) ; writeln ! ( output " " error ) ? ; output . reset ( ) ? ; for cause in error . chain ( ) . skip ( 1 ) { writeln ! ( output " " cause ) ? ; } // Add Backtrace once its stable. // if let Some(backtrace) = error.backtrace() { //   writeln!(output, "{:?}", backtrace)?; // } output . flush ( ) ? ; std :: process :: exit ( 1 ) }
Prints an error to stderr, in the same format that `cargo` uses.
Prints an error to stderr in the same format that ` cargo ` uses .
error
&anyhow::Error
error
&anyhow::Error