feat: navigation slightly improved

This commit is contained in:
2026-02-06 11:05:34 +01:00
parent 5cebdf6444
commit 7529c6ce66
3 changed files with 18 additions and 15 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
/target /target
.blueprints

View File

@@ -74,7 +74,3 @@ pub fn get_base_template_paths() -> Vec<String> {
base_paths base_paths
} }
// ╭───────────────────────╮
// │- Write to filesystem -│
// ╰───────────────────────╯

View File

@@ -31,13 +31,15 @@ fn main() {
if let Ok(target_name) = target_name_result { if let Ok(target_name) = target_name_result {
let mut target_path_heap = "./".to_string(); let mut target_path_heap = "./".to_string();
const CONFIRM_OPTION: &str = "-- Current --"; const CONFIRM_OPTION: &str = " Current";
const CANCEL_OPTION: &str = "-- Cancel --"; const PREV_DIR_OPTION: &str = " ↩ Previous";
const CANCEL_OPTION: &str = " 🗙Cancel";
loop { 'input_loop: loop {
let mut sub_directory_list = get_sub_dirs_paths(&target_path_heap); let mut sub_directory_list = get_sub_dirs_paths(&target_path_heap);
sub_directory_list.insert(0, CONFIRM_OPTION.to_string()); sub_directory_list.insert(0, PREV_DIR_OPTION.to_string());
sub_directory_list.push(CANCEL_OPTION.to_string()); sub_directory_list.insert(1, CONFIRM_OPTION.to_string());
sub_directory_list.insert(2, CANCEL_OPTION.to_string());
let target_path_result = Select::new( let target_path_result = Select::new(
&format!( &format!(
@@ -50,23 +52,27 @@ fn main() {
if let Ok(target_path) = target_path_result { if let Ok(target_path) = target_path_result {
// TODO: also check if dir has no subdirs // TODO: also check if dir has no subdirs
if target_path == CANCEL_OPTION { if target_path == CANCEL_OPTION {
break; break 'input_loop;
} } else if target_path == PREV_DIR_OPTION {
target_path_heap = target_path_heap
if target_path == CONFIRM_OPTION { .rsplit_once("/")
.unwrap_or((&target_path_heap, ""))
.0
.to_string();
} else if target_path == CONFIRM_OPTION {
create_template( create_template(
template_path.clone(), template_path.clone(),
target_name.clone(), target_name.clone(),
target_path_heap.clone(), target_path_heap.clone(),
) )
.unwrap(); .unwrap();
break; break 'input_loop;
} else { } else {
target_path_heap = target_path; target_path_heap = target_path;
} }
} else { } else {
// TODO: manage Error // TODO: manage Error
break; break 'input_loop;
} }
} }
} }