From 1e22d705d4ad329a05edfa7853fb0a165c7a5399 Mon Sep 17 00:00:00 2001 From: "Eshan Roy (Eshanized)" Date: Thu, 2 May 2024 21:34:19 +0530 Subject: [PATCH] refactor: moving test script to main script. --- push.sh | 32 ++++++++++++++++++++++++++++++-- test-push.sh | 10 +++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/push.sh b/push.sh index f719c19..d3b5dce 100755 --- a/push.sh +++ b/push.sh @@ -1,4 +1,32 @@ #!/bin/bash -# Author : Eshan Roy -# Author URI : https://eshanized.github.io/ +# Author : Eshan Roy +# URI : https://eshanized.github.io + +# NOTE: If you are on Snigdha OS, +# you can install commitizen-go with `sudo pacman -S commitizen-go` +# or `s commitizen-go`. Else you need to install `yay` or `yay-bin` +# to install commitizen. I have written this script only for *Arch Linux. + +# Function to check if Commitizen is installed +check_commitizen() { + if ! pacman -Qq commitizen-go &> /dev/null; then + echo "Commitizen is not installed. Please install it using 'yay -S commitizen-go'." >&2 + exit 1 + fi +} + +# Function to stage, commit, and push changes +push_to_github() { + git add . + git cz + git push origin master +} + +# Main Function +main() { + check_commitizen + push_to_github +} + +main diff --git a/test-push.sh b/test-push.sh index 261ebdf..d3b5dce 100755 --- a/test-push.sh +++ b/test-push.sh @@ -1,5 +1,13 @@ #!/bin/bash +# Author : Eshan Roy +# URI : https://eshanized.github.io + +# NOTE: If you are on Snigdha OS, +# you can install commitizen-go with `sudo pacman -S commitizen-go` +# or `s commitizen-go`. Else you need to install `yay` or `yay-bin` +# to install commitizen. I have written this script only for *Arch Linux. + # Function to check if Commitizen is installed check_commitizen() { if ! pacman -Qq commitizen-go &> /dev/null; then @@ -15,7 +23,7 @@ push_to_github() { git push origin master } -# Main script +# Main Function main() { check_commitizen push_to_github