grm

git repo manager for self-hosted git servers
git clone git://sink.krj.st/grm
Log | Files | Refs | README | LICENSE

commit 5f8b34e732eb0ef0dd6ad62ea5ea64e2987da007
parent ddbbe484f6c3d32f0c7d5d57044d363ec5da188f
Author: krasjet <nil@krj.st>
Date:   Sun, 12 Jul 2020 18:37:39 -0700

new command for displaying info about an repo

Diffstat:
Mgrm | 25+++++++++++++++++++++++++
1 file changed, 25 insertions(+), 0 deletions(-)

diff --git a/grm b/grm @@ -175,6 +175,29 @@ grm_recompile() { echo "recompilation done!" } +grm_info() { + repo_name=$1 + repo_dir="${repos_root}/${repo_name}.git" + [ -d "$repo_dir" ] || { echo "can't find repo named $repo_name"; exit 1; } + + echo "name: $repo_name" + + if [ -e "${repo_dir}/git-daemon-export-ok" ]; then + printf "visibility: \x1b[92mpublic\x1b[0m\n" + else + printf "visibility: \x1b[91mprivate\x1b[0m\n" + fi + + [ -f "${repo_dir}/description" ] && \ + echo "description: $(cat "${repo_dir}/description")" + + [ -f "${repo_dir}/owner" ] && \ + echo "owner: $(cat "${repo_dir}/owner")" + + [ -f "${repo_dir}/url" ] && \ + echo "url: $(cat "${repo_dir}/url")" +} + show_help() { cat << EOF usage: $prog_name <command> [<args>] @@ -189,6 +212,7 @@ or commands: new create a new repository + info repo_name display metadata of the repo ls list all repositories ls public list public repositories ls private list private repositories @@ -206,6 +230,7 @@ case "$1" in ls|list) cmd=list;; rm|remove) cmd=remove;; rc|recompile) cmd=recompile;; + info) cmd=info;; *) { show_help; exit; };; esac