diff --git a/.gitignore b/.gitignore index d03cf55..2dd7bc7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,22 @@ -/target -.logs/ +#--------------------------------------------------# +# The following was generated with gitignore.nvim: # +#--------------------------------------------------# +# Gitignore for the following technologies: Rust + +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +# Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +# Log dir +.log/ diff --git a/Cargo.lock b/Cargo.lock index e9eb796..7895f13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,12 +47,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anyhow" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" - [[package]] name = "autocfg" version = "1.5.0" @@ -149,6 +143,33 @@ dependencies = [ "windows-link", ] +[[package]] +name = "color-eyre" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d" +dependencies = [ + "backtrace", + "color-spantrace", + "eyre", + "indenter", + "once_cell", + "owo-colors", + "tracing-error", +] + +[[package]] +name = "color-spantrace" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427" +dependencies = [ + "once_cell", + "owo-colors", + "tracing-core", + "tracing-error", +] + [[package]] name = "compact_str" version = "0.8.1" @@ -363,6 +384,16 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + [[package]] name = "fnv" version = "1.0.7" @@ -704,6 +735,12 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + [[package]] name = "indoc" version = "2.0.6" @@ -913,6 +950,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "owo-colors" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" + [[package]] name = "parking_lot" version = "0.12.4" @@ -1739,6 +1782,16 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-error" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" +dependencies = [ + "tracing", + "tracing-subscriber", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -1788,7 +1841,7 @@ dependencies = [ name = "traxor" version = "0.1.0" dependencies = [ - "anyhow", + "color-eyre", "crossterm 0.29.0", "ratatui", "thiserror 2.0.12", diff --git a/Cargo.toml b/Cargo.toml index c237cd8..855d4e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,13 +6,13 @@ license = "GPLv3" edition = "2021" [dependencies] +color-eyre = "0.6" crossterm = "0.29" ratatui = { version = "0.29" } -transmission-rpc = "0.5" -url = "2.5" -anyhow = "1.0" +thiserror = "2.0" tokio = { version = "1", features = ["macros", "rt-multi-thread"] } tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["env-filter"] } -thiserror = "2.0" tracing-appender = "0.2" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } +transmission-rpc = "0.5" +url = "2.5" diff --git a/src/log.rs b/src/log.rs index ea90cb9..436f2b4 100644 --- a/src/log.rs +++ b/src/log.rs @@ -4,7 +4,7 @@ use tracing_subscriber::{self, layer::SubscriberExt, util::SubscriberInitExt, En pub fn setup_logger() -> Result<()> { std::fs::create_dir_all(".logs")?; - let logfile = rolling::daily(".logs", "traxor.log"); + let logfile = rolling::daily(".log", "traxor.log"); let log_layer = tracing_subscriber::fmt::layer() .with_writer(logfile) .with_ansi(false); @@ -16,4 +16,3 @@ pub fn setup_logger() -> Result<()> { Ok(()) } - diff --git a/src/main.rs b/src/main.rs index e39d5ac..1a388f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,16 @@ -use anyhow::Result; -use log::setup_logger; -use ratatui::backend::CrosstermBackend; -use ratatui::Terminal; -use std::io; -use traxor::app::App; -use traxor::event::{Event, EventHandler}; -use traxor::handler::{get_action, update}; -use traxor::tui::Tui; mod log; +use color_eyre::Result; +use log::setup_logger; +use ratatui::{backend::CrosstermBackend, Terminal}; +use std::io; +use traxor::{ + app::App, + event::{Event, EventHandler}, + handler::{get_action, update}, + tui::Tui, +}; + #[tokio::main] async fn main() -> Result<()> { // Setup the logger.