Skip to content

Commit e19fb33

Browse files
authored
logo and info side by side
1 parent 8062d92 commit e19fb33

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/main.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,20 @@ impl fmt::Display for Info {
2121
s.push_str(&("Number of lines: ".blue().bold().to_string() + &format!("{}\n", self.number_of_lines)));
2222
s.push_str(&("License: ".blue().bold().to_string() + &format!("{}\n", self.license)));
2323
s.push_str(&self.get_ascii().blue().bold().to_string());
24-
write!(f, "{}", s)
24+
25+
let logo= self.get_ascii();
26+
let mut lines = s.lines();
27+
let left_pad = logo.lines().map(|l| l.len()).max().unwrap_or(0);
28+
let mut o = String::new();
29+
for a in logo.lines() {
30+
let b = match lines.next() {
31+
Some(line) => line,
32+
None => "",
33+
};
34+
o.push_str(&format!("{:width$} {}\n", a, b, width = left_pad));
35+
}
36+
37+
write!(f, "{}", o)
2538
}
2639
}
2740

0 commit comments

Comments
 (0)