From 02a678fe267f8eaa68deb5a86be47f80569fd9cc Mon Sep 17 00:00:00 2001
From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr>
Date: Tue, 7 May 2024 17:28:11 +0200
Subject: [PATCH] src/pull.rs: update pull functions

---
 src/pull.rs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/pull.rs b/src/pull.rs
index ccdd0ba..b8ac4b7 100644
--- a/src/pull.rs
+++ b/src/pull.rs
@@ -254,7 +254,12 @@ fn get_remote_archives(url: &PathBuf, adress: &str) -> Vec<String> {
 ///
 /// # Return
 /// The list of archive found remotely
-fn get_archive_list(url: &PathBuf, adress: &str) -> Vec<String> {
+pub(crate) fn get_archive_list(url: &PathBuf, adress: &str) -> Vec<String> {
+    let exist = push::check_dir_exist(url, adress);
+    if !exist {
+        eprintln!("{}: {} folder doesn't exists !", "error".red(), url.to_str().unwrap().yellow());
+        exit(1);
+    }
     if adress == "file" {
         get_local_archives(url)
     } else {
@@ -266,7 +271,7 @@ fn get_archive_list(url: &PathBuf, adress: &str) -> Vec<String> {
 ///
 /// # Argument:
 /// - `remote`: The name of the remote
-fn pull_all_archives(remote: &str) {
+pub(crate) fn pull_all_archives(remote: &str) {
     let (adress, url) = push::get_adress_and_url(remote);
     let archives = get_archive_list(&url, &adress);
     for archive in archives {
-- 
GitLab