blob: f8a6182ee9cdc0906f9c2e115535487cbbff60f7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// nixos-config - My current NixOS configuration
//
// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
// SPDX-License-Identifier: GPL-3.0-or-later
//
// This file is part of my nixos-config.
//
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
use std::path::PathBuf;
use crate::mapping::MapKey;
use super::MappingsTrie;
impl MappingsTrie {
pub fn to_lf_mappings(&self, home_path: PathBuf) -> String {
let mut raw = self
.0
.iter()
.map(|(key, value)| {
format!(
"map g{} cd \"{}\"\n",
MapKey::display(&key),
home_path.join(&value.path).display()
)
})
.collect::<Vec<String>>();
raw.sort();
raw.into_iter().collect()
}
}
|