diff --git a/Cargo.lock b/Cargo.lock index 61b2e31..e5c877b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,6 +204,33 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "color-eyre" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" +dependencies = [ + "backtrace", + "color-spantrace", + "eyre", + "indenter", + "once_cell", + "owo-colors", + "tracing-error", +] + +[[package]] +name = "color-spantrace" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba75b3d9449ecdccb27ecbc479fdc0b87fa2dd43d2f8298f9bf0e59aacc8dce" +dependencies = [ + "once_cell", + "owo-colors", + "tracing-core", + "tracing-error", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -300,6 +327,16 @@ dependencies = [ "libc", ] +[[package]] +name = "eyre" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +dependencies = [ + "indenter", + "once_cell", +] + [[package]] name = "futures" version = "0.3.28" @@ -431,6 +468,12 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + [[package]] name = "is-terminal" version = "0.4.9" @@ -552,9 +595,9 @@ dependencies = [ name = "ogle" version = "1.4.5" dependencies = [ - "anyhow", "chrono", "clap", + "color-eyre", "console", "man", "tokio", @@ -568,6 +611,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + [[package]] name = "pin-project-lite" version = "0.2.12" @@ -629,6 +678,15 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -684,6 +742,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "tokio" version = "1.32.0" @@ -751,6 +819,48 @@ dependencies = [ "tokio", ] +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-error" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +dependencies = [ + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "sharded-slab", + "thread_local", + "tracing-core", +] + [[package]] name = "unicode-ident" version = "1.0.11" @@ -769,6 +879,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index 0643774..ede259d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["watch", "command-line"] [dependencies] clap = { version = "4.3.23", features = ["derive"] } -anyhow = "1.0.75" +color-eyre = "0.6.2" tokio = "1.32.0" tokio-stream = "0.1.14" console = "0.15.7" @@ -26,7 +26,7 @@ default-features = false features = ["clock"] [build-dependencies] -anyhow = "1.0.75" +color-eyre = "0.6.2" man = "0.3.0" [package.metadata.deb] diff --git a/build.rs b/build.rs index f44be38..c352e0f 100644 --- a/build.rs +++ b/build.rs @@ -2,7 +2,7 @@ // This file is subject to the terms and conditions defined in // file 'LICENSE', which is part of this source code package. -use anyhow::Result; +use color_eyre::{eyre::eyre, Result}; use man::prelude::*; use std::env; use std::error::Error; @@ -10,7 +10,7 @@ use std::fs::{self, File}; use std::io::Write; use std::path; -fn generate_man_page>(outdir: P) -> anyhow::Result<()> { +fn generate_man_page>(outdir: P) -> Result<()> { let outdir = outdir.as_ref(); let man_path = outdir.join("ogle.1"); let manpage = Manual::new("ogle") @@ -71,9 +71,9 @@ fn generate_man_page>(outdir: P) -> anyhow::Result<()> { } fn main() -> Result<(), Box> { - let mut outdir = path::PathBuf::from( - env::var_os("OUT_DIR").ok_or_else(|| anyhow::anyhow!("error getting OUT_DIR"))?, - ); + color_eyre::install()?; + let mut outdir = + path::PathBuf::from(env::var_os("OUT_DIR").ok_or_else(|| eyre!("error getting OUT_DIR"))?); fs::create_dir_all(&outdir)?; generate_man_page(&outdir)?; // build/ogle-*/out diff --git a/src/progbar.rs b/src/progbar.rs index 0dc0abf..49e56d8 100644 --- a/src/progbar.rs +++ b/src/progbar.rs @@ -2,7 +2,7 @@ // This file is subject to the terms and conditions defined in // file 'LICENSE', which is part of this source code package. -use anyhow::Result; +use color_eyre::Result; use console::Term; use tokio::time; diff --git a/src/runner.rs b/src/runner.rs index 12e6f83..acb2cc7 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -2,7 +2,7 @@ // This file is subject to the terms and conditions defined in // file 'LICENSE', which is part of this source code package. -use anyhow::Result; +use color_eyre::Result; use std::convert::TryFrom; use std::process::ExitStatus; use std::process::Stdio;