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
.blueprints

View File

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

View File

@@ -31,13 +31,15 @@ fn main() {
if let Ok(target_name) = target_name_result {
let mut target_path_heap = "./".to_string();
const CONFIRM_OPTION: &str = "-- Current --";
const CANCEL_OPTION: &str = "-- Cancel --";
const CONFIRM_OPTION: &str = " Current";
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);
sub_directory_list.insert(0, CONFIRM_OPTION.to_string());
sub_directory_list.push(CANCEL_OPTION.to_string());
sub_directory_list.insert(0, PREV_DIR_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(
&format!(
@@ -50,23 +52,27 @@ fn main() {
if let Ok(target_path) = target_path_result {
// TODO: also check if dir has no subdirs
if target_path == CANCEL_OPTION {
break;
}
if target_path == CONFIRM_OPTION {
break 'input_loop;
} else if target_path == PREV_DIR_OPTION {
target_path_heap = target_path_heap
.rsplit_once("/")
.unwrap_or((&target_path_heap, ""))
.0
.to_string();
} else if target_path == CONFIRM_OPTION {
create_template(
template_path.clone(),
target_name.clone(),
target_path_heap.clone(),
)
.unwrap();
break;
break 'input_loop;
} else {
target_path_heap = target_path;
}
} else {
// TODO: manage Error
break;
break 'input_loop;
}
}
}