Created
October 9, 2025 09:19
-
-
Save do-me/c9db917d80c64c25e024fdcbd98cae71 to your computer and use it in GitHub Desktop.
A shell scirpt cloning a github repo, running yek to copy all text files to clipboard, then deleting the repo for easy pasting in Gemini or other long context models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Usage: clone_yek_copy <github_repo_url> | |
| # Description: Clones a GitHub repo, runs `yek | pbcopy`, then deletes the repo. | |
| set -e | |
| # --- 1️⃣ Check for URL argument --- | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 <github_repo_url>" | |
| exit 1 | |
| fi | |
| repo_url="$1" | |
| repo_name=$(basename -s .git "$repo_url") | |
| # --- 2️⃣ Detect OS and set clipboard command --- | |
| if command -v pbcopy &> /dev/null; then | |
| CLIP_CMD="pbcopy" | |
| elif command -v xclip &> /dev/null; then | |
| CLIP_CMD="xclip -selection clipboard" | |
| elif command -v wl-copy &> /dev/null; then | |
| CLIP_CMD="wl-copy" | |
| else | |
| echo "❌ No clipboard command found! Install pbcopy (macOS), xclip or wl-clipboard (Linux)." | |
| exit 1 | |
| fi | |
| # --- 3️⃣ Clone the repo --- | |
| echo "📥 Cloning $repo_url..." | |
| git clone "$repo_url" | |
| cd "$repo_name" | |
| # --- 4️⃣ Run yek and copy output --- | |
| if ! command -v yek &> /dev/null; then | |
| echo "❌ 'yek' not found! Please install it first." | |
| cd .. | |
| rm -rf "$repo_name" | |
| exit 1 | |
| fi | |
| echo "⚙️ Running yek and copying output..." | |
| yek | $CLIP_CMD | |
| # --- 5️⃣ Clean up --- | |
| cd .. | |
| rm -rf "$repo_name" | |
| echo "🧹 Deleted cloned repo." | |
| echo "✅ Done! Output copied to clipboard." |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chmod +x copygit.shcopygit https://github.com/do-me/SemanticFinderOutput:
This one takes less than 1 sec on my system
0.10s user 0.11s system 28% cpu 0.735 total