replace anyhow and log with color_eyre and tracing

Since Himalaya is intended to be ran as a CLI in the terminal emulator
environment, their user experience could vastly improve with better and
more colorful error messages and logging.

This change will replace more minimal libraries for error-reporting/han-
dling with their more advanced counterparts.

Since these crates have tight integrations, this commit will change both
in one shot.

Also we have don't need env_logger any more. So I also have removed that
guy as well.

Signed-off-by: Perma Alesheikh <me@prma.dev>
This commit is contained in:
Perma Alesheikh
2024-04-15 00:10:46 +03:30
committed by Clément DOUIN
parent cc79f5cc38
commit 5a0ff83a5e
68 changed files with 376 additions and 198 deletions
+15 -1
View File
@@ -1,5 +1,5 @@
use anyhow::Result;
use clap::{Parser, Subcommand};
use color_eyre::Result;
use std::path::PathBuf;
use crate::{
@@ -75,6 +75,20 @@ pub struct Cli {
#[arg(long, short = 'C', global = true)]
#[arg(value_name = "MODE", value_enum, default_value_t = Default::default())]
pub color: ColorFmt,
/// Enable logs with spantrace.
///
/// This is the same as running the command with `RUST_LOG=debug`
/// environment variable.
#[arg(long, global = true, conflicts_with = "trace")]
pub debug: bool,
/// Enable verbose logs with backtrace.
///
/// This is the same as running the command with `RUST_LOG=trace`
/// and `RUST_BACKTRACE=1` environment variables.
#[arg(long, global = true, conflicts_with = "debug")]
pub trace: bool,
}
#[derive(Subcommand, Debug)]