From 726b400463107d343e5c028fbc525bce92e61a92 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Mon, 1 Apr 2024 14:10:23 +0100 Subject: [PATCH] Slightly prettier output --- agb-addr2line/Cargo.toml | 1 + agb-addr2line/src/main.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/agb-addr2line/Cargo.toml b/agb-addr2line/Cargo.toml index 1727ca6d..63130c8b 100644 --- a/agb-addr2line/Cargo.toml +++ b/agb-addr2line/Cargo.toml @@ -14,6 +14,7 @@ addr2line = { version = "0.21", default-features = false, features = [ "rustc-demangle", "std-object", ] } +colored = "2" [profile.dev] opt-level = 3 diff --git a/agb-addr2line/src/main.rs b/agb-addr2line/src/main.rs index b13a9b6d..b71985fb 100644 --- a/agb-addr2line/src/main.rs +++ b/agb-addr2line/src/main.rs @@ -2,6 +2,7 @@ use std::{fs, path::PathBuf}; use addr2line::{gimli, object}; use clap::Parser; +use colored::Colorize; #[derive(Parser, Debug)] #[command(version, about, long_about = None)] @@ -65,7 +66,12 @@ fn print_address(ctx: &addr2line::Context, address: u64) -> }) .unwrap_or_default(); - println!("{function_name} ({}:{})", location.filename, location.line); + println!( + "{}\n\t{}:{}", + function_name.white(), + location.filename.green(), + location.line.to_string().green() + ); } Ok(())