diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 519f2fe..9d52a2b 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,2 +1 @@ pub mod new; -pub mod new_folder; diff --git a/src/commands/new_folder.rs b/src/commands/new_folder.rs deleted file mode 100644 index 199e757..0000000 --- a/src/commands/new_folder.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::fs::{create_dir_all, File}; - -use crate::{ - configurations::get::get_value_from_config, files::build_paths::build_folder_path_for_now, -}; - -pub fn new_folder() -> std::io::Result { - // compose path of the day - let not_path = get_value_from_config("not_path").unwrap(); - let new_folder_path = build_folder_path_for_now(¬_path); - - // create folder of the composed path (and recursive parents if needed) - match create_dir_all(&new_folder_path) { - Ok(_result) => { - println!("✅ Folder has been created successfully!"); - - // create a the config { "created_at": "2025-12-31T23:59:59Z", "type": "day" } - let config_file_path = format!("{}{}", new_folder_path, ".not-config.json"); - - match File::create(&config_file_path) { - Ok(_file) => { - println!("✅ Config file created: {}", config_file_path); - // add minimal content to the config file - } - Err(e) => { - eprintln!("Error creating file: {}", e); - } - }; - - // create the default file in the folder - let default_file_path = format!("{}{}", new_folder_path, "not.md"); - - match File::create(&default_file_path) { - Ok(_file) => { - println!("✅ Default file created: {}", default_file_path); - // add minimal content to the default file: the date and add an info in config file - } - Err(e) => { - eprintln!("Error creating file: {}", e); - } - }; - } - Err(e) => { - eprintln!("Error creating folder: {}", e); - return Err(e); - } - } - - Ok("Nost has created the folder successfully!".to_string()) -} diff --git a/src/main.rs b/src/main.rs index 4a7349f..c233749 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,8 +34,6 @@ fn main() { end_work(); } else if args[1] == "work-stats" || args[1] == "ws" { work_stats(args); - } else if args[1] == "new-folder" || args[1] == "nf" { - let _ = commands::new_folder::new_folder(); } else if args[1] == "new-default" || args[1] == "nn" { // wip new();