From 34ddec75936a7afd17af50954e7185026e79e9ff Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 6 Aug 2025 16:04:54 +0100 Subject: =?UTF-8?q?=E2=9C=A8feat:=20improve=20error=20message=20formatting?= =?UTF-8?q?=20with=20colored=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 10 ++++++++++ Cargo.toml | 1 + src/main.rs | 6 +++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c95b724..ac07c2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -179,6 +179,15 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "colored" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "console" version = "0.16.0" @@ -1859,6 +1868,7 @@ name = "zap-rs" version = "0.1.0" dependencies = [ "clap", + "colored", "derive_more", "futures-util", "indicatif", diff --git a/Cargo.toml b/Cargo.toml index 1f384cf..21eea19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ edition = "2024" [dependencies] clap = { version = "4.5.41", features = ["derive"] } +colored = "3.0.0" derive_more = { version = "2.0.1", features = ["from"] } futures-util = "0.3.31" indicatif = { version = "0.18.0", features = ["improved_unicode"] } diff --git a/src/main.rs b/src/main.rs index 7840fae..3eb7e95 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ -use std::path::PathBuf; - use clap::Parser; +use colored::Colorize; +use std::path::PathBuf; use zap_rs::{AppImage, Cli, Command, PackageManager, Result, Source, SourceMetadata}; @@ -35,7 +35,7 @@ async fn run() -> Result<()> { #[tokio::main] async fn main() { if let Err(e) = run().await { - eprintln!("Error: {e}"); + eprintln!("{} {}", "Error:".red().bold(), e); std::process::exit(1); } } -- cgit v1.2.3