Skip to content

Commit 900a5b6

Browse files
committed
refactor: switch to color_eyre
1 parent 0a0d471 commit 900a5b6

File tree

16 files changed

+241
-134
lines changed

16 files changed

+241
-134
lines changed

Cargo.lock

Lines changed: 206 additions & 102 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ authors = ["Ryan Cao <[email protected]>"]
66
publish = false
77

88
[dependencies]
9-
anyhow = "1.0.75"
109
async-recursion = "1.0.5"
1110
async-trait = "0.1.74"
1211
clap = { version = "4.4.6", features = ["derive"] }
1312
clap_complete = "4.4.3"
13+
color-eyre = "0.6.2"
1414
dirs = "5.0.1"
1515
enum_dispatch = "0.3.12"
1616
nanoid = "0.4.0"

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use anyhow::Result;
21
use async_trait::async_trait;
32
use clap::Parser;
3+
use color_eyre::eyre::Result;
44

55
use crate::config;
66

src/cmd/completions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use clap_complete::{generate, Shell};
22
use std::io::stdout;
33

4-
use anyhow::Result;
54
use async_trait::async_trait;
65
use clap::{CommandFactory, Parser};
6+
use color_eyre::eyre::Result;
77

88
#[derive(Parser)]
99
pub struct CompletionCommand {

src/cmd/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use anyhow::{anyhow, Result};
21
use async_trait::async_trait;
32
use clap::{Parser, Subcommand};
3+
use color_eyre::eyre::{eyre, Result};
44

55
use crate::config;
66

@@ -48,7 +48,7 @@ impl super::Command for ConfigCommand {
4848
.userchromes
4949
.iter()
5050
.find(|d| d.name.eq(name))
51-
.ok_or(anyhow!("no userchrome with name {} exists", name))?;
51+
.ok_or(eyre!("no userchrome with name {} exists", name))?;
5252

5353
for c in &uc.configs {
5454
println!("{}", config::format_userchrome_config(c));
@@ -68,7 +68,7 @@ impl super::Command for ConfigCommand {
6868
.userchromes
6969
.iter_mut()
7070
.find(|d| d.name.eq(name))
71-
.ok_or(anyhow!("no userchrome with name {} exists", name))?;
71+
.ok_or(eyre!("no userchrome with name {} exists", name))?;
7272

7373
let existing = chrome.configs.iter_mut().find(|c| c.key == *key);
7474

@@ -94,7 +94,7 @@ impl super::Command for ConfigCommand {
9494
.userchromes
9595
.iter_mut()
9696
.find(|d| d.name.eq(name))
97-
.ok_or(anyhow!("no userchrome with name {} exists", name))?;
97+
.ok_or(eyre!("no userchrome with name {} exists", name))?;
9898

9999
let existing = chrome.configs.iter_mut().position(|c| c.key == *key);
100100

src/cmd/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use anyhow::Result;
21
use async_trait::async_trait;
32
use clap::Parser;
3+
use color_eyre::eyre::Result;
44

55
use crate::config;
66

src/cmd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::config::get_default_config_path;
22
use clap::{Parser, Subcommand, ValueHint};
33

4-
use anyhow::Result;
54
use async_trait::async_trait;
5+
use color_eyre::eyre::Result;
66
use enum_dispatch::enum_dispatch;
77

88
mod add;

src/cmd/preset.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use anyhow::{anyhow, Result};
21
use async_trait::async_trait;
32
use clap::Parser;
3+
use color_eyre::eyre::{eyre, Result};
44

55
use crate::{config, presets};
66

@@ -19,7 +19,7 @@ impl super::Command for PresetCommand {
1919
let preset = presets
2020
.into_iter()
2121
.find(|p| p.name == *name)
22-
.ok_or(anyhow!("no preset named {} exists!", name))?;
22+
.ok_or(eyre!("no preset named {} exists!", name))?;
2323

2424
let mut config = config::get_config(&global_options.config).await?;
2525

src/cmd/profile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use anyhow::Result;
21
use async_trait::async_trait;
32
use clap::{Parser, ValueHint};
3+
use color_eyre::eyre::Result;
44

55
use crate::config;
66

0 commit comments

Comments
 (0)