summaryrefslogtreecommitdiff
path: root/parse_cgit
diff options
context:
space:
mode:
Diffstat (limited to 'parse_cgit')
-rwxr-xr-xparse_cgit14
1 files 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 <urlbase> <destdir>\n" $0
+ printf "Usage: %s <urlbase> <destdir> [<repourl>]\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