Skip to content

Commit

Permalink
Migrate from anyhow to color_eyre
Browse files Browse the repository at this point in the history
  • Loading branch information
lpenz committed Aug 19, 2023
1 parent 7f69572 commit 3bf352d
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 10 deletions.
118 changes: 117 additions & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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]
Expand Down
10 changes: 5 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// 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;
use std::fs::{self, File};
use std::io::Write;
use std::path;

fn generate_man_page<P: AsRef<path::Path>>(outdir: P) -> anyhow::Result<()> {
fn generate_man_page<P: AsRef<path::Path>>(outdir: P) -> Result<()> {
let outdir = outdir.as_ref();
let man_path = outdir.join("ogle.1");
let manpage = Manual::new("ogle")
Expand Down Expand Up @@ -71,9 +71,9 @@ fn generate_man_page<P: AsRef<path::Path>>(outdir: P) -> anyhow::Result<()> {
}

fn main() -> Result<(), Box<dyn Error>> {
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
Expand Down
2 changes: 1 addition & 1 deletion src/progbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3bf352d

Please sign in to comment.