From 3f3247c6a45e8d629a75e8a52c96aa9d36ec87da Mon Sep 17 00:00:00 2001 From: Eshan Roy Date: Tue, 19 Nov 2024 09:24:36 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20feat(config):=20add=20gihub=20cr?= =?UTF-8?q?ed=20config=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- git-config.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 git-config.sh diff --git a/git-config.sh b/git-config.sh new file mode 100755 index 0000000..319678b --- /dev/null +++ b/git-config.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Author: Eshan Roy ] [--username ] [-h]" + echo " --email Set the GitHub user email." + echo " --username Set the GitHub username." + echo " -h Display this help message." + exit 1 +} + +# Parse command line arguments +while [[ "$#" -gt 0 ]]; do + case "$1" in + --email) + EMAIL="$2" + shift 2 + ;; + --username) + USERNAME="$2" + shift 2 + ;; + -h|--help) + usage + ;; + *) + echo "Unknown parameter passed: $1" + usage + ;; + esac +done + +# Prompt for email if not provided +if [ -z "$EMAIL" ]; then + read -p "Enter your GitHub email: " EMAIL +fi + +# Prompt for username if not provided +if [ -z "$USERNAME" ]; then + read -p "Enter your GitHub username: " USERNAME +fi + +# Set the Git configuration +git config --global user.email "$EMAIL" +git config --global user.name "$USERNAME" + +# Confirmation message +echo "GitHub configuration updated:" +echo " User Email: $EMAIL" +echo " Username: $USERNAME" \ No newline at end of file