mirror of
https://github.com/Snigdha-OS/snigdhaos-falcon.git
synced 2025-09-20 15:24:55 +02:00
🔨 refactor(shortcut): add our config + push script!
This commit is contained in:
53
config.sh
Executable file
53
config.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Author: Eshan Roy <eshan@snigdhaos.org>
|
||||
# Author URI : https://eshanized.github.io
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [--email <email>] [--username <username>] [-h]"
|
||||
echo " --email <email> Set the GitHub user email"
|
||||
echo " --username <email> Set the GitHub username"
|
||||
echo " -h Display the help message"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--email)
|
||||
EMAIL="$2"
|
||||
shift 2
|
||||
;;
|
||||
--username)
|
||||
USERNAME="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument found: $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# We will ask prompt for email address if not entered by the user
|
||||
if [ -z "$EMAIL" ]; then
|
||||
read -p "Enter your GitHub Email: " EMAIL
|
||||
fi
|
||||
|
||||
# We will ask prompt for username if not entered by the user
|
||||
if [ -z "$USERNAME" ]; then
|
||||
read -p "Enter your GitHub Username: " USERNAME
|
||||
fi
|
||||
|
||||
# Setting up github config
|
||||
git config --global user.email "$EMAIL"
|
||||
git config --global user.name "$USERNAME"
|
||||
|
||||
# Get a confirmation message on successful update!
|
||||
echo "GitHub Configuration setup successfull!"
|
||||
echo " User Email: $EMAIL"
|
||||
echo " Username: $USERNAME"
|
52
push.sh
Executable file
52
push.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Author : ESHAN ROY
|
||||
# Author URI : https://eshanized.github.io
|
||||
|
||||
# NOTE : Run at your own Risk!
|
||||
|
||||
# Define the conventional commit types with emojis
|
||||
TYPES=("🎉 feat" "🐞 fix" "📚 docs" "💅 style" "🔨 refactor" "⚡️ perf" "🧪 test" "🛠️ build" "🤖 ci" "🧹 chore" "⏪️ revert")
|
||||
|
||||
# Prompt the user to select a commit type
|
||||
echo "Select a commit type:"
|
||||
select type in "${TYPES[@]}"; do
|
||||
break
|
||||
done
|
||||
|
||||
# Extract the commit type and emoji from the selection
|
||||
type_emoji=${type}
|
||||
type=${type_emoji#* }
|
||||
emoji=${type_emoji% *}
|
||||
|
||||
# Prompt the user to enter a scope (optional)
|
||||
read -p "Enter a scope (optional): " scope
|
||||
|
||||
# Prompt the user to enter a short description
|
||||
read -p "Enter a short description: " desc
|
||||
|
||||
# Prompt the user to enter a longer description (optional)
|
||||
read -p "Enter a longer description (optional): " long_desc
|
||||
|
||||
# Create the commit message
|
||||
commit_msg="$emoji $type($scope): $desc"
|
||||
|
||||
# If a longer description was provided, add it to the commit message
|
||||
if [ -n "$long_desc" ]; then
|
||||
commit_msg+="
|
||||
|
||||
$long_desc"
|
||||
fi
|
||||
|
||||
# Print the commit message to the console
|
||||
echo "Commit message:"
|
||||
echo "$commit_msg"
|
||||
|
||||
# Stage all changes
|
||||
git add .
|
||||
|
||||
# Commit the changes with the conventional commit message
|
||||
git commit -m "$commit_msg"
|
||||
|
||||
# Push the changes to the remote repository
|
||||
git push origin $(git rev-parse --abbrev-ref HEAD)
|
Reference in New Issue
Block a user