Updated zrep version to 0.0.5

- Updated version to 0.0.5
- Added validation for package name format
- Display error message if package name format is incorrect
This commit is contained in:
Stig-Ørjan Smelror 2024-04-02 21:57:39 +02:00
parent 8f34150a78
commit 2e0d42c040

7
zrep
View File

@ -2,7 +2,7 @@
setopt extendedglob setopt extendedglob
VERSION="0.0.4" # Sun-2024-03-31 VERSION="0.0.5" # Tue-2024-04-02
ZREP="Zsh Repository Tool" ZREP="Zsh Repository Tool"
# Define the default path to .zreprc # Define the default path to .zreprc
ZREP_CONFIG="${HOME}/.zreprc" ZREP_CONFIG="${HOME}/.zreprc"
@ -646,6 +646,11 @@ function zrep_install_package() {
else else
updates=false updates=false
local package="${1}" local package="${1}"
# Ensure package name is in 'author/package' format
if [[ ! "${package}" =~ ^.+/[^/]+$ ]]; then
zrep_msg debug "\nError: Package name must be in 'author/package' format."
return 1
fi
# Call zrep_check_if_installed to check if the package is already installed # Call zrep_check_if_installed to check if the package is already installed
if zrep_check_if_installed "${package}"; then if zrep_check_if_installed "${package}"; then
zrep_msg debug "\nPackage ${package} is already installed." zrep_msg debug "\nPackage ${package} is already installed."