feat: Support --verbose flag #23

Merged
awiteb merged 2 commits from awiteb/fix-21 into master 2024-04-30 16:49:22 +02:00 AGit
2 changed files with 10 additions and 4 deletions
Showing only changes of commit e14fe76960 - Show all commits

View file

@ -58,12 +58,14 @@ impl_commands!(Commands, Add Remove List Clean Edit Gen Export Import);
#[command(author, version, about, long_about = None)]
pub struct Cli {
/// The vaults json file
#[arg(short = 'f', long)]
pub vaults_file: Option<PathBuf>,
/// Show the logs in the stdout
#[arg(short, long)]
vaults_file: Option<PathBuf>,
pub verbose: bool,
// TODO: verbose flag
#[command(subcommand)]
command: Commands,
pub command: Commands,
}
impl Cli {

View file

@ -43,6 +43,10 @@ pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const LAST_VERSION_CHECK_FILE: &str = ".last_version_check";
fn main() -> ExitCode {
let lprs_cli = cli::Cli::parse();
if lprs_cli.verbose {
std::env::set_var("RUST_LOG", "lprs");
}
pretty_env_logger::init();
#[cfg(feature = "update-notify")]
@ -64,7 +68,7 @@ fn main() -> ExitCode {
}
}
if let Err(err) = cli::Cli::parse().run() {
if let Err(err) = lprs_cli.run() {
if !matches!(
err,
LprsError::Inquire(InquireError::OperationCanceled)