Skip to content

Commit

Permalink
Implement logging logic
Browse files Browse the repository at this point in the history
  • Loading branch information
szaffarano committed Feb 2, 2025
1 parent 7f49558 commit 5e2ed7e
Show file tree
Hide file tree
Showing 3 changed files with 200 additions and 23 deletions.
209 changes: 192 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ categories = ["command-line-utilities"]
[dependencies]
anyhow = "1.0.95"
clap = { version = "4.5.27", features = ["derive"] }
clap-verbosity-flag = "3.0.2"
directories-next = "2.0.0"
indoc = "2.0.5"
log = "0.4.25"
regex = "1.11.1"
serde = { version = "1.0.217", features = ["derive"] }
simple_logger = "5.0.0"
toml = "0.8.19"
10 changes: 5 additions & 5 deletions src/bin/rofi-cliphist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::path::PathBuf;

use anyhow::bail;
use clap::Parser;
use log::debug;
use log::{debug, Level};
use roto::{
cache, clipboard, cliphist, config,
rofi::{self, cliphist_mode::ClipHistMode},
Expand All @@ -12,8 +12,8 @@ use roto::{
#[command(version, about, long_about = None)]
struct Args {
/// Show verbose output
#[clap(short, long)]
verbose: bool,
#[command(flatten)]
verbose: clap_verbosity_flag::Verbosity,

/// Path to rofi executable
#[clap(short, long, default_value = "rofi")]
Expand All @@ -33,10 +33,10 @@ struct Args {
}

fn main() -> anyhow::Result<()> {
env_logger::init();

let args = Args::parse();

simple_logger::init_with_level(args.verbose.log_level().unwrap_or(Level::Error))?;

let mut cfg = if let Some(config_path) = &args.config {
config::load(config_path).expect("Error loading config file")
} else {
Expand Down

0 comments on commit 5e2ed7e

Please sign in to comment.