Added user interaction for setting up zrep for the first time.

- Display welcome message when running zrep for the first time.
- Prompt user to set up zrep if config file is not found.
- Added user confirmation before running 'zrep init'.
This commit is contained in:
Stig-Ørjan Smelror 2024-03-16 00:10:00 +01:00
parent 3345f78b7a
commit 7243ae4235

8
zrep
View File

@ -366,13 +366,15 @@ function zrep_load_config() {
zrep_fpath ${config[main_zrep_install_dir]} zrep_fpath ${config[main_zrep_install_dir]}
else else
if [[ "${1}" == "init" ]]; then if [[ "${1}" == "init" ]]; then
echo "${ZREP_CONFIG} not found. Proceeding with 'zrep init'..." echo "\nWelcome to zrep. Looks like this is the first time you are"
echo "running me."
read "response?Are you ready to set up zrep? (y/n): "
if [[ "${response}" =~ ^[Yy]$ ]]; then
zrep_init zrep_init
else else
# echo "${ZREP_CONFIG} not found." # echo "${ZREP_CONFIG} not found."
# Ask the user if they want to run 'zrep init' # Ask the user if they want to run 'zrep init'
echo "\nWelcome to zrep. Looks like this is the first time you are" echo "\nWelcome to zrep. I was unable to find the config file."
echo "running me."
read "response?Would you like to run 'zrep init' to set up? (y/n): " read "response?Would you like to run 'zrep init' to set up? (y/n): "
if [[ "${response}" =~ ^[Yy]$ ]]; then if [[ "${response}" =~ ^[Yy]$ ]]; then
zrep_init zrep_init