Fix directory removal logic in zrep_remove_package function

- Corrected the logic to check if the first letter directory is empty before deletion
- Updated the README with work-in-progress status and a call for help and feedback - Mon, 04 Mar 2024 20:34:23 +0100
This commit is contained in:
Stig-Ørjan Smelror 2024-03-04 20:34:23 +01:00
parent ad7ef3d777
commit bc1c7f4e4f
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,10 @@
# zrep
The Zsh Repository tool, akin to PyPi and pip
The Zsh Repository tool, akin to PyPi and pip
<hr>
This is a work in progress. Some functionality is in place, but the back-end is still missing a lot.
Would love help and feedback!

2
zrep
View File

@ -313,7 +313,7 @@ function zrep_remove_package() {
echo "Author directory '$author_dir' removed successfully."
# Check if the first letter directory is empty and delete it if so
if [[ $(($#first_letter/*)) -eq 0 ]]; then
if [[ -d "${config[main_zrep_install_dir]}/$first_letter" && ! *(D) "${config[main_zrep_install_dir]}/$first_letter" ]]; then
rm -rf "${config[main_zrep_install_dir]}/$first_letter"
echo "First letter directory '${config[main_zrep_install_dir]}/$first_letter' removed successfully."
fi