summaryrefslogtreecommitdiff
path: root/scripts/create_alias.sh
diff options
context:
space:
mode:
authorKeith Ballinger <[email protected]>2025-06-07 22:22:32 -0700
committerGitHub <[email protected]>2025-06-07 22:22:32 -0700
commit84678c6448df8fd382d5433a635472c934c85b14 (patch)
treebc3b2ae8d7187221b3444bfc10b8bbadaac1cce1 /scripts/create_alias.sh
parent569c9774080a517fd32dc14545a4f5e71020b4e4 (diff)
Makefile for convenience (#833)
Diffstat (limited to 'scripts/create_alias.sh')
-rwxr-xr-xscripts/create_alias.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/create_alias.sh b/scripts/create_alias.sh
new file mode 100755
index 00000000..599078b9
--- /dev/null
+++ b/scripts/create_alias.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# This script creates an alias for the Gemini CLI
+
+# Determine the project directory
+PROJECT_DIR=$(cd "$(dirname "$0")/.." && pwd)
+ALIAS_COMMAND="alias gemini='$PROJECT_DIR/scripts/start.sh'"
+
+# Detect shell and set config file path
+if [[ "$SHELL" == *"/bash" ]]; then
+ CONFIG_FILE="$HOME/.bashrc"
+elif [[ "$SHELL" == *"/zsh" ]]; then
+ CONFIG_FILE="$HOME/.zshrc"
+else
+ echo "Unsupported shell. Only bash and zsh are supported."
+ exit 1
+fi
+
+echo "This script will add the following alias to your shell configuration file ($CONFIG_FILE):"
+echo " $ALIAS_COMMAND"
+echo ""
+
+# Check if the alias already exists
+if grep -q "alias gemini=" "$CONFIG_FILE"; then
+ echo "A 'gemini' alias already exists in $CONFIG_FILE. No changes were made."
+ exit 0
+fi
+
+read -p "Do you want to proceed? (y/n) " -n 1 -r
+echo ""
+if [[ $REPLY =~ ^[Yy]$ ]]; then
+ echo "$ALIAS_COMMAND" >> "$CONFIG_FILE"
+ echo ""
+ echo "Alias added to $CONFIG_FILE."
+ echo "Please run 'source $CONFIG_FILE' or open a new terminal to use the 'gemini' command."
+else
+ echo "Aborted. No changes were made."
+fi