Skip to content

Commit

Permalink
fix(cli): have log command lookup file w/ timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
LGUG2Z committed May 17, 2024
1 parent 835472d commit d2470b1
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
62 changes: 62 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions komorebic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ komorebi-core = { path = "../komorebi-core" }
komorebi-client = { path = "../komorebi-client" }

clap = { version = "4", features = ["derive", "wrap_help"] }
chrono = "0.4"
color-eyre = { workspace = true }
dirs = { workspace = true }
dunce = { workspace = true }
Expand Down
4 changes: 3 additions & 1 deletion komorebic/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![warn(clippy::all, clippy::nursery, clippy::pedantic)]
#![allow(clippy::missing_errors_doc)]

use chrono::Local;
use std::fs::File;
use std::fs::OpenOptions;
use std::io::BufRead;
Expand Down Expand Up @@ -1490,7 +1491,8 @@ fn main() -> Result<()> {
println!("\n#Include komorebic.lib.ahk");
}
SubCommand::Log => {
let color_log = std::env::temp_dir().join("komorebi.log");
let timestamp = Local::now().format("%Y-%m-%d").to_string();
let color_log = std::env::temp_dir().join(format!("komorebi.log.{timestamp}"));
let file = TailedFile::new(File::open(color_log)?);
let locked = file.lock();
#[allow(clippy::significant_drop_in_scrutinee, clippy::lines_filter_map_ok)]
Expand Down

0 comments on commit d2470b1

Please sign in to comment.