ea-command 0.2.1

Editor Alias: making paths in command line tools actionable.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::archive;

pub fn print(number: usize, format: &str) {
    let mut result = format.to_string();
    let list = archive::read();
    if number <= list.len() {
        let location = &list[number - 1];
        result = result.replace("{path}", &location.path);
        result = result.replace("{line}", &location.line.unwrap_or(1).to_string());
        result = result.replace("{column}", &location.column.unwrap_or(1).to_string());

        println!("{}", &result);
    }
}