aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/lf/lf-make-map/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/lf/lf-make-map/src/main.rs')
-rw-r--r--pkgs/by-name/lf/lf-make-map/src/main.rs89
1 files changed, 2 insertions, 87 deletions
diff --git a/pkgs/by-name/lf/lf-make-map/src/main.rs b/pkgs/by-name/lf/lf-make-map/src/main.rs
index d5d934e1..1576c1dd 100644
--- a/pkgs/by-name/lf/lf-make-map/src/main.rs
+++ b/pkgs/by-name/lf/lf-make-map/src/main.rs
@@ -39,6 +39,7 @@ fn main() -> anyhow::Result<()> {
let relevant_directories = match &args.command {
Command::Visualize { options } => &options.relevant_directories,
Command::Generate { options } => &options.relevant_directories,
+ Command::Interactive { options } => &options.relevant_directories,
};
for dir in relevant_directories {
@@ -99,6 +100,7 @@ fn main() -> anyhow::Result<()> {
match args.command {
Command::Visualize { .. } => println!("{}", mappings.0),
Command::Generate { .. } => println!("{}", mappings.to_lf_mappings(args.home_name)),
+ Command::Interactive { .. } => mappings.interactive_start(args.home_name)?,
}
Ok(())
@@ -144,90 +146,3 @@ because it can't be turned to a string
)
})
}
-
-// fn gen_lf_mappings(home_name: PathBuf, char_num: usize, rel_dirs: Vec<PathBuf>) {
-// let mut mappings_vec = vec![];
-// let mut index_counter = 0;
-// rel_dirs.iter().for_each(|rel_dir| {
-// mappings_vec.push(vec![Mapping::new(
-// &gen_hot_key(rel_dir, rel_dir, char_num),
-// rel_dir,
-// rel_dir,
-// None,
-// )]);
-// get_dir(rel_dir.to_owned()).iter().for_each(|path| {
-// mappings_vec[index_counter].push(Mapping::new(
-// &gen_hot_key(
-// path,
-// path.parent().expect("All paths here should have parents"),
-// char_num,
-// ),
-// path,
-// &path
-// .parent()
-// .expect("All paths here should have parents")
-// .to_owned(),
-// None,
-// ));
-// });
-// index_counter += 1;
-// });
-// print_mappings(&mappings_vec, home_name);
-// mappings_vec
-// .into_iter()
-// .for_each(|rel_dir_mapping: Vec<Mapping>| {
-// let mut hash_map = sort_mapping_by_hot_key(rel_dir_mapping.clone());
-// //dbg!(hash_map);
-// hash_map.insert("gsi".to_owned(), vec![rel_dir_mapping[0].clone()]);
-// });
-// }
-//
-// fn sort_mapping_by_hot_key(mut mappings: Vec<Mapping>) -> HashMap<String, Vec<Mapping>> {
-// mappings.sort_by_key(|mapping| mapping.hot_key.clone());
-//
-// let mut filtered_mappings: HashMap<String, Vec<Mapping>> = HashMap::new();
-// mappings.iter().for_each(|mapping| {
-// filtered_mappings.insert(mapping.hot_key.clone(), vec![]);
-// });
-// //dbg!(&mappings);
-//
-// let mut index_counter = 1;
-// mappings.iter().for_each(|mapping| {
-// if mappings.len() > index_counter {
-// let next_mapping = &mappings[index_counter];
-// let vec = filtered_mappings
-// .get_mut(&mapping.hot_key)
-// .expect("This existst as it has been initialized");
-//
-// if &next_mapping.hot_key == &mapping.hot_key {
-// vec.push(mapping.clone());
-// vec.push(next_mapping.clone());
-// } else {
-// vec.push(mapping.clone());
-// }
-//
-// let new_vec = vec.to_owned();
-// filtered_mappings.insert(mapping.hot_key.to_owned(), new_vec);
-// }
-//
-// index_counter += 1;
-// });
-// filtered_mappings
-// }
-//
-// fn print_mappings(mappings: &Vec<Vec<Mapping>>, home_name: PathBuf) {
-// for mapping in mappings {
-// mapping.iter().for_each(|map| {
-// println!(
-// "{} = \"cd {}\";",
-// map.hot_key,
-// map.path
-// .display()
-// .to_string()
-// .replace(home_name.to_str().expect("This should be UTF-8"), "~")
-// );
-// });
-//
-// println!("# -------------");
-// }
-// }