From f48555f8591af05ceb9c21dd5db1646d91412d45 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Tue, 29 Sep 2026 06:42:30 -0700 Subject: [PATCH] bashrc, move the project seeding to its own functions and have code-reseed call it, check if the dir exists before cloning. --- tasks/general/acct_mgmt/users.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index 6ecdb01..f93d950 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -692,15 +692,9 @@ hugo-rvr dev nomadic-weather dev nomadic-weather.wiki main - EOF + EOF } - function code-reseed { - # Unseed current projects. - echo -e "\n*** Move old projects to TRASH ***" - unseed_dir="$HOME/TRASH/`date +%Y%m%d_%H%M%S`_UnseededCodeProjects" - mkdir -pv "$unseed_dir" - mv -v $HOME/Code/* "$unseed_dir"/ 2>/dev/null - + function code-seed { # Git repo information. git_repo_ssh={{ git_repo_ssh }} git_main_project={{ git_project }} @@ -710,7 +704,7 @@ git_projects_to_sync | while read git_project git_branch; do echo -e "\n*** $git_project ***" - # Project folder manipulation. + # Project folder name manipulation. dest_folder="$git_project" if [[ "$dest_folder" == "flutter-"* ]]; then echo "FLUTTER: Removing 'flutter-' and using '_' rather than '-'." @@ -718,11 +712,24 @@ dest_folder="${dest_folder//-/_}" fi - # Download of the project. - git clone ${git_repo_ssh_basename}${git_project} \ - --branch $git_branch $HOME/Code/$dest_folder + # Download the project. + if [[ ! -d $HOME/Code/$dest_folder ]]; then + git clone ${git_repo_ssh_basename}${git_project} \ + --branch $git_branch $HOME/Code/$dest_folder + else + echo "'$dest_folder' already exists, skipping." + fi done } + function code-reseed { + # Unseed current projects. + echo -e "\n*** Move old projects to TRASH ***" + unseed_dir="$HOME/TRASH/`date +%Y%m%d_%H%M%S`_UnseededCodeProjects" + mkdir -pv "$unseed_dir" + mv -v $HOME/Code/* "$unseed_dir"/ 2>/dev/null + + code-seed + } function_clean_filenames: | function clean-filenames() { # Must provide the directory you'd like to clean all the filenames in.