From ed75014df6e75b44ee8a31bcedf53fda63fcba7e Mon Sep 17 00:00:00 2001 From: Trey Bastian Date: Thu, 9 Apr 2026 20:59:08 +0100 Subject: added support for a description and testing out claude --- git-shell-commands/new-repo | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'git-shell-commands/new-repo') diff --git a/git-shell-commands/new-repo b/git-shell-commands/new-repo index c2c454a..80f7ec9 100755 --- a/git-shell-commands/new-repo +++ b/git-shell-commands/new-repo @@ -3,27 +3,45 @@ set -euo pipefail # this script creates a bare git repository on the git server # # USAGE: -# ssh git@ new-repo +# ssh git@ new-repo [--description ] # # EXAMPLES: # ssh git@treybastian.com new-repo myrepo # ssh git@treybastian.com new-repo myrepo.git +# ssh git@treybastian.com new-repo myrepo --description "my cool repo" usage() { - echo "Usage: new-repo " + echo "Usage: new-repo [--description ]" echo "" echo "Examples:" echo " new-repo myrepo" echo " new-repo myrepo.git" + echo " new-repo myrepo --description \"my cool repo\"" exit 1 } -if [ "$#" -ne 1 ]; then - echo "Error: expected 1 argument, got $#" +if [ "$#" -lt 1 ]; then + echo "Error: expected at least 1 argument, got $#" usage fi PROJECT_NAME="$1" +DESCRIPTION="" +shift + +while [ "$#" -gt 0 ]; do + case "$1" in + --description) + [ "$#" -ge 2 ] || { echo "Error: --description requires a value"; usage; } + DESCRIPTION="$2" + shift 2 + ;; + *) + echo "Error: unknown flag '$1'" + usage + ;; + esac +done if [[ "$PROJECT_NAME" != *.git ]]; then PROJECT_NAME="${PROJECT_NAME}.git" @@ -36,6 +54,10 @@ fi git --bare init "$PROJECT_NAME" +if [ -n "$DESCRIPTION" ]; then + echo "$DESCRIPTION" > "${PROJECT_NAME}/description" +fi + echo "repo created: $PROJECT_NAME" echo "git url: ${USER}@${HOSTNAME}:${PROJECT_NAME}" -- cgit v1.2.3