summaryrefslogtreecommitdiff
path: root/src/reports/source_hierarchy.rs
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2025-04-27 12:38:40 +1200
committerBen Bridle <ben@derelict.engineering>2025-04-27 12:38:40 +1200
commitc13c1f2748598343e01128c3f734df309aa4a26d (patch)
tree0fdef6bbdac5e32031ea90146ad030d4892e260a /src/reports/source_hierarchy.rs
parent55e64d35273a425b52b7d913b9368af2f0370bbb (diff)
downloadassembler-c13c1f2748598343e01128c3f734df309aa4a26d.zip
Replace ansi library with inked library
The inked library handles colours correctly on Windows. The log library has also been updated to the newer version which uses inked internally.
Diffstat (limited to 'src/reports/source_hierarchy.rs')
-rw-r--r--src/reports/source_hierarchy.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/reports/source_hierarchy.rs b/src/reports/source_hierarchy.rs
index 2e88a77..f391785 100644
--- a/src/reports/source_hierarchy.rs
+++ b/src/reports/source_hierarchy.rs
@@ -7,7 +7,7 @@ pub struct SourceHierarchy<'a> {
impl<'a> SourceHierarchy<'a> {
pub fn report(&self) {
- eprintln!(".");
+ ink!(".").eprintln();
let len = self.resolver.root_unit_ids.len();
for (i, id) in self.resolver.root_unit_ids.iter().enumerate() {
let end = i + 1 == len;
@@ -19,29 +19,29 @@ impl<'a> SourceHierarchy<'a> {
// A level entry is true if all entries in that level have been printed.
for level in &levels {
match level {
- false => eprint!("│ "),
- true => eprint!(" "),
+ false => ink!("│ ").eprint(),
+ true => ink!(" ").eprint(),
}
}
// The end value is true if all siblings of this entry have been printed.
match end {
- false => eprint!("├── "),
- true => eprint!("└── "),
+ false => ink!("├── ").eprint(),
+ true => ink!("└── ").eprint(),
}
let unit = &self.resolver.source_units[id];
let path_str = &unit.source_unit.main.path.as_os_str().to_string_lossy();
if let Some(name_str) = unit.source_unit.name() {
- eprint!("{name_str}{BLUE}");
- if unit.source_unit.head.is_some() { eprint!(" +head") }
- if unit.source_unit.tail.is_some() { eprint!(" +tail") }
+ ink!("{name_str}").eprint();
+ if unit.source_unit.head.is_some() { ink!(" +head").blue().eprint() }
+ if unit.source_unit.tail.is_some() { ink!(" +tail").blue().eprint() }
let mut unresolved = 0;
for symbol in &self.resolver.unresolved {
if symbol.source_id == id { unresolved += 1; }
}
- if unresolved > 0 { eprint!("{RED} ({unresolved})"); }
- eprintln!("{NORMAL} {DIM}({path_str}){NORMAL}");
+ if unresolved > 0 { ink!(" ({unresolved})").red().eprint(); }
+ ink!(" ({path_str})").dim().eprintln();
} else {
- eprintln!("{path_str}");
+ ink!("{path_str}").eprintln();
}
levels.push(end);
let len = unit.child_ids.len();