aboutsummaryrefslogtreecommitdiff
path: root/cgit/ssh/git-shell-commands/list
blob: 668bfbbd1554acd39aaeff6d67d7ad27732bad60 (plain) (blame)
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
#!/usr/bin/env sh

set -eu

. "$(dirname $0)/_utils/input.sh"

git_dir=/git
remote_host="git.ediblemonad.dev"

if (tty -s); then
  selected=$(select_repo_name)

  if ! [ -z "$selected" ]; then
    repo_dir="${git_dir}/${selected}"
    echo "# ${selected}"
    echo ""
    echo "- SSH clone url: git@${remote_host}:${repo_dir}"
    echo "- HTTPS clone url: https://${remote_host}/${selected}"
    echo ""
    echo "- Category: $(git -C "$repo_dir" config get gitweb.category)"
    echo ""
    echo "- Description: $(cat "${repo_dir}/description" 2>/dev/null)"
  fi
else
  ls -1 "$git_dir" | while IPS="" read name; do
    echo "$name||||$(cat "${git_dir}/${name}/description" 2>/dev/null)"
  done | column -t -d -s "||||"
fi