aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/lf/lf-make-map
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/lf/lf-make-map')
-rw-r--r--pkgs/by-name/lf/lf-make-map/Cargo.lock40
-rw-r--r--pkgs/by-name/lf/lf-make-map/Cargo.toml4
-rw-r--r--pkgs/by-name/lf/lf-make-map/src/mapping/map_key.rs31
3 files changed, 40 insertions, 35 deletions
diff --git a/pkgs/by-name/lf/lf-make-map/Cargo.lock b/pkgs/by-name/lf/lf-make-map/Cargo.lock
index 2fd11d38..799f83ef 100644
--- a/pkgs/by-name/lf/lf-make-map/Cargo.lock
+++ b/pkgs/by-name/lf/lf-make-map/Cargo.lock
@@ -72,9 +72,9 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.102"
+version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
+checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3"
[[package]]
name = "autocfg"
@@ -96,9 +96,9 @@ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
[[package]]
name = "cc"
-version = "1.2.64"
+version = "1.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dad887fd958be91b5098c0248def011f4523ab786cd411be668777e55063501f"
+checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96"
dependencies = [
"find-msvc-tools",
"shlex",
@@ -294,9 +294,9 @@ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
[[package]]
name = "js-sys"
-version = "0.3.102"
+version = "0.3.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31"
+checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102"
dependencies = [
"cfg-if",
"futures-util",
@@ -354,9 +354,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.32"
+version = "0.4.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a"
+checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
[[package]]
name = "mio"
@@ -431,9 +431,9 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.45"
+version = "1.0.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
+checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
dependencies = [
"proc-macro2",
]
@@ -551,9 +551,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
-version = "2.0.117"
+version = "2.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
+checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
dependencies = [
"proc-macro2",
"quote",
@@ -628,9 +628,9 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "wasm-bindgen"
-version = "0.2.125"
+version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a"
+checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4"
dependencies = [
"cfg-if",
"once_cell",
@@ -641,9 +641,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.125"
+version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d"
+checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -651,9 +651,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.125"
+version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd"
+checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -664,9 +664,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.125"
+version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f"
+checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24"
dependencies = [
"unicode-ident",
]
diff --git a/pkgs/by-name/lf/lf-make-map/Cargo.toml b/pkgs/by-name/lf/lf-make-map/Cargo.toml
index bd37ec4a..8411a4b9 100644
--- a/pkgs/by-name/lf/lf-make-map/Cargo.toml
+++ b/pkgs/by-name/lf/lf-make-map/Cargo.toml
@@ -17,10 +17,10 @@ edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-anyhow = "1.0.102"
+anyhow = "1.0.103"
clap = { version = "4.6.1", features = ["derive", "env"] }
crossterm = {version = "0.29.0", default-features = false, features = ["events"]}
keymaps = "1.2.0"
-log = "0.4.32"
+log = "0.4.33"
stderrlog = "0.6.0"
walkdir = "2.5.0"
diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/map_key.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/map_key.rs
index d90eb963..6d88d5af 100644
--- a/pkgs/by-name/lf/lf-make-map/src/mapping/map_key.rs
+++ b/pkgs/by-name/lf/lf-make-map/src/mapping/map_key.rs
@@ -48,8 +48,8 @@ impl PartialOrd for MapKey {
}
impl MapKey {
- pub fn new_from_part_path(part_path: &str, resolution: usize) -> Vec<Self> {
- let key = Self::part_path_to_key(part_path, resolution);
+ pub fn new_from_part_path(part_path: &str, resolution: usize, full_path: &str) -> Vec<Self> {
+ let key = Self::path_part_to_key(part_path, resolution, Some(full_path));
key.chars()
.map(|ch| Self {
@@ -63,7 +63,7 @@ impl MapKey {
pub fn new_ones_from_path(path: &str, number_of_chars: usize) -> Vec<Self> {
let key: Vec<MapKey> = path
.split('/')
- .flat_map(|part| Self::new_from_part_path(part, number_of_chars))
+ .flat_map(|part| Self::new_from_part_path(part, number_of_chars, path))
.collect();
debug!(
@@ -80,10 +80,10 @@ impl MapKey {
// debug!("Incrementing: '{}' ('{}')", &self, &self.part_path);
let added_chars = if new_resolution < self.part_path.len() {
- MapKey::part_path_to_key(&self.part_path, new_resolution)
+ MapKey::path_part_to_key(&self.part_path, new_resolution, None)
} else {
let mut generated_chars =
- MapKey::part_path_to_key(&self.part_path, self.part_path.len());
+ MapKey::path_part_to_key(&self.part_path, self.part_path.len(), None);
generated_chars.extend(
(0..(new_resolution - self.part_path.len()))
@@ -112,16 +112,21 @@ impl MapKey {
values.iter().map(|value| value.key).collect()
}
- fn part_path_to_key(part: &str, number_of_chars: usize) -> String {
- fn make(pat: char, part: &str, number_of_chars: usize) -> String {
+ fn path_part_to_key(part: &str, number_of_chars: usize, full_path: Option<&str>) -> String {
+ fn make(pat: char, part: &str, number_of_chars: usize, full_path: Option<&str>) -> String {
let mut acc = String::new();
- if !part.split(pat).all(|part| !part.is_empty()) {
+ if part.split(pat).all(|split| split.is_empty()) {
panic!(
"\
-Can't turn this path '{}' to a mapping.
-This should not happen, please report the bug!",
- part
+Failed to split path part `{part}`, with pattern `{pat}`, because all resulting split parts are empty. {}
+This should not happen, please report this bug!", {
+ if let Some(full_path) = full_path {
+ format!("(Full path was: `{full_path}`)")
+ } else {
+ String::new()
+ }
+ }
)
}
@@ -148,9 +153,9 @@ This should not happen, please report the bug!",
}
let value = if part.contains('_') && !part.starts_with('_') && !part.ends_with('_') {
- make('_', part, number_of_chars)
+ make('_', part, number_of_chars, full_path)
} else if part.contains('-') && !part.starts_with('-') && !part.ends_with('-') {
- make('-', part, number_of_chars)
+ make('-', part, number_of_chars, full_path)
} else if part.starts_with('.') {
// HACK: Special case for directories like ~/.config ~/.local and so on.
// We just drop the starting '.' and it's easier to type. <2026-06-02>