feat: Support --verbose
flag
This commit is contained in:
parent
8cf18db314
commit
e14fe76960
2 changed files with 10 additions and 4 deletions
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue