-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·32 lines (24 loc) · 946 Bytes
/
install.sh
File metadata and controls
executable file
·32 lines (24 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# Define scripts to work with
SCRIPTS=("wtadd.sh" "wtremove.sh" "wtclone.sh" "wtlist.sh")
# Define the repository URL and the destination directory
REPO_URL="https://github.com/tomups/worktrees-scripts.git"
DEST_DIR="$HOME/.local/bin"
# Create the destination directory if it does not exist
mkdir -p "$DEST_DIR"
# Clone the repository into a temporary directory
TEMP_DIR=$(mktemp -d)
git clone "$REPO_URL" "$TEMP_DIR"
for script in "${SCRIPTS[@]}"; do
# Copy the specified shell scripts to the destination directory
cp "$TEMP_DIR/$script" "$DEST_DIR"
# Add execute permissions to the scripts
chmod +x "$DEST_DIR/$script"
# Add git aliases for each script
script_name=$(basename "$script" .sh)
git config --global alias."$script_name" "!$DEST_DIR/$script"
done
# Clean up the temporary directory
rm -rf "$TEMP_DIR"
# Notify the user
echo "Shell scripts have been installed and configured as git aliases."