From 57ed43be9db7243a1f03e689236c143b4967fc0d Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Fri, 10 Jan 2020 06:57:02 +0000 Subject: allow alternative repo url in parse_cgit --- parse_cgit | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/parse_cgit b/parse_cgit index d6951af..183d574 100755 --- a/parse_cgit +++ b/parse_cgit @@ -5,7 +5,7 @@ # if [ $# -lt 2 ]; then - printf "Usage: %s \n" $0 + printf "Usage: %s []\n" $0 exit 1 fi @@ -17,6 +17,14 @@ CURL="torify curl -Ls " TMPFILE="./tmp_$$" READMES="README README.txt README.md readme readme.txt readme.md" + +if [ $# -gt 2 ]; then + REPOURL="$3" +else + REPOURL="$URLBASE" +fi + + ## func cleanup () { rm -f $TMPFILE @@ -67,7 +75,7 @@ get_readmes() { } PROTO=${URLBASE%%:\/\/*} -DIRBASE="$PROTO/${URLBASE##[a-z]*:\/\/}" +DIRBASE="$PROTO/${REPOURL##[a-z]*:\/\/}" echo "proto: $PROTO" echo "dirbase: $DIRBASE" @@ -81,7 +89,7 @@ for r in $repos; do printf "Retrieving repo %s...\n" $repo link=$(echo "$r" | cut -d "|" -f 1 ) name=$(echo "$r" | cut -d "|" -f 2 ) - baselink=$(printf "%s%s" $URLBASE $link) + baselink=$(printf "%s%s" $REPOURL $link) REPODIR="$DEST/$DIRBASE/$link/" mkdir -p $REPODIR get_descr "$link" "$baselink" > ${REPODIR}/DESCR -- cgit v1.2.3