summaryrefslogtreecommitdiff
path: root/list
blob: 43cc82b79fcf89328e770d1805027f4fea82d76e (plain)
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
#!/bin/sh
# List all git repositories

echo "Available repositories:"
echo ""

cd "$HOME" || exit 1

# Count only .git repositories
repo_count=$(find . -maxdepth 1 -type d -name "*.git" | wc -l)

if [ "$repo_count" -eq 0 ]; then
    echo "  (no repositories yet)"
    echo ""
    echo "Create one with: init-repo <name>"
else
    for repo in *.git; do
        if [ -d "$repo" ]; then
            echo "  $repo"
            if [ -f "$repo/description" ]; then
                desc=$(cat "$repo/description")
                if [ "$desc" != "Unnamed repository; edit this file 'description' to name the repository." ]; then
                    echo "    → $desc"
                fi
            fi
        fi
    done
fi