echo -e "''${RED}==> ✖ Cancelled.''${RESET}" | tee -a $LOGFILE
printLogfileAndExit -1
}
# Function for unified logging and display
log_action() {
if [ $? -eq 0 ]; then
echo -e " ''${GREEN}✔''${RESET} $1: Successful" | tee -a $LOGFILE
else
echo -e " ''${RED}✖''${RESET} $1: Failed" | tee -a $LOGFILE
printLogfileAndExit 1
fi
}
print_what_to_do() {
echo -e "\n\nWhat do you want to do?\n"
}
git_status=$(git status --porcelain)
if [[ -z "$git_status" ]]; then
log_error_and_display "No changes to commit. Exiting."
printLogfileAndExit 0
fi
print_what_to_do() {
echo -e "\n\nWhat do you want to do?\n"
}
print_headline "Choose commit type"
selection=$(gum choose "feat: (new feature for the user, not a new feature for build script)" "fix: (bug fix for the user, not a fix to a build script)" "chore: (updating grunt tasks etc.; no production code change)" "docs: (changes to the documentation)" "style: (formatting, missing semi colons, etc; no production code change)" "refactor: (refactoring production code, eg. renaming a variable)" "test: (adding missing tests, refactoring tests; no production code change)" "Cancel")
log_error_and_display "No changes to commit. Exiting."
printLogfileAndExit 0
fi
if [[ "$commit_type" == "Cancel" ]]; then
do_cancel
fi
print_headline "Choose commit type"
selection=$(gum choose "feat: (new feature for the user, not a new feature for build script)" "fix: (bug fix for the user, not a fix to a build script)" "chore: (updating grunt tasks etc.; no production code change)" "docs: (changes to the documentation)" "style: (formatting, missing semi colons, etc; no production code change)" "refactor: (refactoring production code, eg. renaming a variable)" "test: (adding missing tests, refactoring tests; no production code change)" "Cancel")
log_and_display "You chose the commit type: $commit_type"