ea_command/commands/print.rs
1use crate::archive;
2
3pub fn print(number: usize, format: &str) {
4 let mut result = format.to_string();
5 let list = archive::read();
6 if number <= list.len() {
7 let location = &list[number - 1];
8 result = result.replace("{path}", &location.path);
9 result = result.replace("{line}", &location.line.unwrap_or(1).to_string());
10 result = result.replace("{column}", &location.column.unwrap_or(1).to_string());
11
12 println!("{}", &result);
13 }
14}