about summary refs log tree commit diff stats
path: root/pkgs/sources/lf-make-map/src/mapping/map_tree/lf_mapping.rs
blob: 6d9c7a0d7de1da3329bff92b1eae1e849389fe6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::path::PathBuf;

use crate::mapping::MapKey;

use super::MappingTree;

impl MappingTree {
    pub fn to_lf_mappings(self, home_path: PathBuf) -> String {
        self.iter(true)
            .map(|(key, value)| {
                format!(
                    "map g{} cd \"{}\"\n",
                    MapKey::display(&key),
                    home_path.join(&value).display()
                )
            })
            .collect()
    }
}