From 53bd010da62894c05511defe7c398f60513541fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Fri, 15 Mar 2024 22:16:33 +0100 Subject: [PATCH] Title: Update zrep script with downloader choice validation - Fixed downloader choice validation in zrep_init function - Moved zrep_fpath and autoload commands to else block for existing config handling --- zrep | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zrep b/zrep index 12efcad..c4d9427 100755 --- a/zrep +++ b/zrep @@ -24,9 +24,6 @@ function zrep_fpath() { done } -zrep_fpath ${HOME}/.zrep/functions -autoload -Uz zini - # Define a list of colors available to use in themes typeset -A base_colors=( [green]="\033[0;32m" @@ -156,10 +153,10 @@ function zrep_init() { read "install_dir?Enter zrep installation directory [${HOME}/.zrep]: " install_dir=${install_dir:-"${HOME}/.zrep"} read "downloader?Choose command to download packages [curl, wget, wget2]: " - if [[ ${downloader} != "curl" || ${downloader} != "wget" || ${downloader} != "wget2" ]]; then + if [[ ${downloader} != curl || ${downloader} != wget || ${downloader} != wget2 ]]; then echo "Invalid choice: '$downloader'. Try again." read "downloader?Choose command to download packages [curl, wget, wget2] " - if [[ ${downloader} != "curl" || ${downloader} != "wget" || ${downloader} != "wget2" ]]; then + if [[ ${downloader} != curl || ${downloader} != wget || ${downloader} != wget2 ]]; then echo "Invalid choice: '$downloader'. Exiting." exit fi @@ -177,6 +174,8 @@ downloader = ${downloader} EOF echo "The file '${ZREP_CONFIG}' has been created." else + zrep_fpath ${HOME}/.zrep/functions + autoload -Uz zini echo "Loading configuration from ${ZREP_CONFIG}" zini ${ZREP_CONFIG} install_dir=${config[main_zrep_install_dir]}