Update zpi tool with new features and improvements:

- Updated tool name to "Zrep Package Installer"
- Modified installation directory prompt
- Renamed commands related to zrep to zpi
- Updated help messages and usage instructions
- Improved package management functionality
This commit is contained in:
Stig-Ørjan Smelror 2024-04-06 00:24:26 +02:00
parent 8569de68ec
commit 30ffb0f6bb

18
zpi
View File

@ -3,7 +3,7 @@
setopt extendedglob setopt extendedglob
VERSION="0.0.8" # Fri-2024-04-05 VERSION="0.0.8" # Fri-2024-04-05
ZREP="Zsh Repository Tool" ZREP="Zrep Package Installer"
# Define the default path to .zreprc # Define the default path to .zreprc
ZREP_CONFIG="${HOME}/.zreprc" ZREP_CONFIG="${HOME}/.zreprc"
@ -234,7 +234,7 @@ function zrep_init() {
if [[ ! -f ${ZREP_CONFIG} ]]; then if [[ ! -f ${ZREP_CONFIG} ]]; then
echo "${ZREP_CONFIG} not found. Creating it..." echo "${ZREP_CONFIG} not found. Creating it..."
# Prompt user for install directory # Prompt user for install directory
read "install_dir?Enter zrep installation directory [${HOME}/.zrep]: " read "install_dir?Enter zpi installation directory [${HOME}/.zrep]: "
install_dir=${install_dir:-"${HOME}/.zrep"} install_dir=${install_dir:-"${HOME}/.zrep"}
mkdir -p ${install_dir} mkdir -p ${install_dir}
read "downloader?Choose command to download packages [curl, wget, wget2]: " read "downloader?Choose command to download packages [curl, wget, wget2]: "
@ -857,18 +857,18 @@ function zrep_disable() {
# Help function to display available options # Help function to display available options
function zrep_help() { function zrep_help() {
zrep_msg sub "\nUsage: zrep <command> [arguments]" zrep_msg sub "\nUsage: ${ZSH_SCRIPT:t} <command> [arguments]"
zrep_msg info "Available commands:" zrep_msg info "Available commands:"
if [[ ! -f ${ZREP_CONFIG} ]]; then if [[ ! -f ${ZREP_CONFIG} ]]; then
zrep_msg info " init: Initialize zrep" zrep_msg info " init: Initialize zpi"
fi fi
zrep_msg info " install (i) <author/package>:\t\t\tInstall a package" zrep_msg info " install (i) <author/package>:\t\t\tInstall a package"
zrep_msg info " remove (rm, delete, del) <author/package>:\tRemove a package" zrep_msg info " remove (rm, delete, del) <author/package>:\tRemove a package"
zrep_msg info " update (u) <author/package>:\t\t\tUpdate zrep package" zrep_msg info " update (u) <author/package>:\t\t\tUpdate zpi package"
zrep_msg info " enable <author/package>:\t\t\tEnable zrep package" zrep_msg info " enable <author/package>:\t\t\tEnable zpi package"
zrep_msg info " disable <author/package>:\t\t\tDisable zrep package" zrep_msg info " disable <author/package>:\t\t\tDisable zpi package"
zrep_msg info " search 'search term':\t\t\t\tSearch for authors, packages or description" zrep_msg info " search 'search term':\t\t\t\tSearch for authors, packages or description"
zrep_msg info " version:\t\t\t\t\tDisplay zrep version" zrep_msg info " version:\t\t\t\t\tDisplay zpi version"
zrep_msg info " list:\t\t\t\t\t\tList installed packages" zrep_msg info " list:\t\t\t\t\t\tList installed packages"
zrep_msg info " <author/package> help:\t\t\tDisplay help for package (if available)" zrep_msg info " <author/package> help:\t\t\tDisplay help for package (if available)"
@ -952,7 +952,7 @@ function main() {
# Parse the command argument to extract the package name # Parse the command argument to extract the package name
zrep_remove_package_name="${2:-}" zrep_remove_package_name="${2:-}"
if [[ -z "${zrep_remove_package_name}" ]]; then if [[ -z "${zrep_remove_package_name}" ]]; then
zrep_msg info "\nUsage: zrep ${1} author/package" zrep_msg info "\nUsage: zpi ${1} author/package"
else else
zrep_remove_package "${zrep_remove_package_name}" zrep_remove_package "${zrep_remove_package_name}"
fi fi