aboutsummaryrefslogtreecommitdiff
path: root/cgit/ssh/git-shell-commands/list
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xcgit/ssh/git-shell-commands/list26
1 files changed, 23 insertions, 3 deletions
diff --git a/cgit/ssh/git-shell-commands/list b/cgit/ssh/git-shell-commands/list
index 8a924c9..668bfbb 100755
--- a/cgit/ssh/git-shell-commands/list
+++ b/cgit/ssh/git-shell-commands/list
@@ -1,8 +1,28 @@
#!/usr/bin/env sh
+set -eu
+
+. "$(dirname $0)/_utils/input.sh"
+
git_dir=/git
+remote_host="git.ediblemonad.dev"
-ls -1 "$git_dir" | while IPS="" read name; do
- echo "$name||||$(cat "${git_dir}/${name}/description" 2>/dev/null)"
-done | column -t -d -s "||||"
+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