Skip to content

Commit

Permalink
Updated git directory confirmation
Browse files Browse the repository at this point in the history
The script now asks the user for confirmation to proceed after detecting that the current directory is a Git repository.
  • Loading branch information
whxitte authored Oct 30, 2024
1 parent 7353c88 commit f52b21a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions gixposed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ echo -e "${COLOR_CYAN}
___ _ (_)__ __ ___ ___ ___ ___ ___/ /
/ _ \`// / \\ \\ // _ \\/ _ \\ (_-</ -_)/ _ /
\\_, //_/ /_\\_\\/ .__/\\___//___/\\__/ \\_,_/
/___/ /_/
/___/ /_/
@whxitte
${COLOR_RESET}"

Expand Down Expand Up @@ -79,9 +79,19 @@ get_github_repo_details() {
# Check if the specified path is a Git repository
while true; do
if check_git_repo "$repo_path"; then
echo -e "${COLOR_GREEN}Current directory is a Git repository. Proceeding...${COLOR_RESET}"
cd "$repo_path" || exit
break
echo -e "${COLOR_GREEN}Current directory is a Git repository.${COLOR_RESET}"
echo -ne "${COLOR_YELLOW}Do you want to proceed? (y/n): ${COLOR_RESET}"
read -r proceed_choice

if [[ "$proceed_choice" =~ ^[Yy]$ ]]; then
cd "$repo_path" || exit
break
elif [[ "$proceed_choice" =~ ^[Nn]$ ]]; then
echo -e "${COLOR_RED}Exiting the script.${COLOR_RESET}"
exit 0
else
echo -e "${COLOR_RED}Invalid choice. Please enter 'y' or 'n'.${COLOR_RESET}"
fi
else
echo -e "${COLOR_RED}This is not a Git repository.${COLOR_RESET}"
echo -ne "${COLOR_YELLOW}Please enter a valid Git repository path: ${COLOR_RESET}"
Expand Down

0 comments on commit f52b21a

Please sign in to comment.