From 7f01167804c10633ecfe2bc47ce375be4adb8eb8 Mon Sep 17 00:00:00 2001 From: "Mario S.O" Date: Sun, 30 Jun 2024 08:17:57 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Improved=20function=20names=20fo?= =?UTF-8?q?r=20dotfile=20searching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib.rs | 4 ++-- src/utils.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7da84a4..8de99a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,7 +35,7 @@ use crate::lock::{ }; use crate::utils::{ get_current_working_dir, - check_for_sensitive_files_or_directories_recursive, + check_dotfiles_recursive, prompt_user_for_confirmation }; use crate::versioning::push_version; @@ -279,7 +279,7 @@ pub async fn run(command: Subcommands) -> Result<(), SoldeerError> { let path_buf = PathBuf::from(&path); // Check for sensitive files or directories - if check_for_sensitive_files_or_directories_recursive(&path_buf) { + if check_dotfiles_recursive(&path_buf) { if !prompt_user_for_confirmation() { println!("{}", Paint::yellow("Push operation aborted by the user.")); return Ok(()); diff --git a/src/utils.rs b/src/utils.rs index 2ba67a3..718399c 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -119,7 +119,7 @@ pub fn get_base_url() -> String { } // Function to check for the presence of sensitive files or directories -pub fn check_for_sensitive_files_or_directories(path: &Path) -> bool { +pub fn check_dotfiles(path: &Path) -> bool { if let Ok(entries) = fs::read_dir(path) { for entry in entries { if let Ok(entry) = entry { @@ -135,8 +135,8 @@ pub fn check_for_sensitive_files_or_directories(path: &Path) -> bool { } // Function to recursively check for sensitive files or directories in a given path -pub fn check_for_sensitive_files_or_directories_recursive(path: &Path) -> bool { - if check_for_sensitive_files_or_directories(path) { +pub fn check_dotfiles_recursive(path: &Path) -> bool { + if check_dotfiles(path) { return true; } @@ -144,7 +144,7 @@ pub fn check_for_sensitive_files_or_directories_recursive(path: &Path) -> bool { for entry in fs::read_dir(path).unwrap() { let entry = entry.unwrap(); let entry_path = entry.path(); - if check_for_sensitive_files_or_directories_recursive(&entry_path) { + if check_dotfiles_recursive(&entry_path) { return true; } }