Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
runs-on: ubuntu-latest
permissions:
checks: read
needs: [lockfile, lint]
steps:
- name: Wait for checks
uses: poseidon/wait-for-status-checks@v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
match_pattern: test
lockfile:
runs-on: ubuntu-latest
steps:
Expand Down
38 changes: 17 additions & 21 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ anstream = "0.6.4"
clap = { version = "4.4.7", features = ["derive", "wrap_help"] }
clap-verbosity-flag = "2.1.0"
colorchoice-clap = "1.0.3"
eyre = "0.6.12"
owo-colors = "3.5.0"
proc-exit = "2.0.1"
thiserror = "1.0.39"
tracing = "0.1.37"
tracing-log = { version = "0.1.3", default-features = false, features = ["log-tracer", "std"] }
tracing-subscriber = "0.3.16"
Expand Down
32 changes: 9 additions & 23 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
use std::{
io::{Error as IoError, Write},
result::Result as StdResult,
};
use std::io::Write;

use anstream::{eprintln, stderr, stdout};
use eyre::Result as EyreResult;
use owo_colors::OwoColorize;
use proc_exit::Code;

#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("{0}")]
Io(#[from] IoError),
}

impl Error {
fn print(&self) {
eprintln!("{}: {self}", "error".red().bold());
}

fn code(&self) -> Code {
Code::FAILURE
}
}

pub type Result<T = ()> = StdResult<T, Error>;
pub type Result<T = ()> = EyreResult<T>;

pub fn finish(result: Result) {
let code = if let Some(e) = result.err() {
e.print();
e.code()
// Use `e.is::<Error>()` to check for a specific error
// in order to wrap all instances of it.
let err = e;

eprintln!("{}: {err}", "error".red().bold());
Code::FAILURE
} else {
Code::SUCCESS
};
Expand Down