summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaz <ndpm13@ch-naseem.com>2025-08-06 16:04:54 +0100
committerNaz <ndpm13@ch-naseem.com>2025-08-06 16:04:54 +0100
commit34ddec75936a7afd17af50954e7185026e79e9ff (patch)
tree18bc8295ba558ebf70988a993f4626299c48d1bb
parent209dcb3e6f50a6289197b4cb3c78e069c327c21e (diff)
✨feat: improve error message formatting with colored output
-rw-r--r--Cargo.lock10
-rw-r--r--Cargo.toml1
-rw-r--r--src/main.rs6
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
@@ -180,6 +180,15 @@ 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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -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);
}
}