diff --git a/ls-mirrors.sh b/ls-mirrors.sh new file mode 100755 index 0000000000000000000000000000000000000000..8036bf714266b57ffc4527041c7539b0356b2d50 --- /dev/null +++ b/ls-mirrors.sh @@ -0,0 +1,38 @@ +#!/bin/bash +#Created by Sam Gleske +#MIT License +#Created Sat Sep 14 15:50:13 EDT 2013 +#USAGE +# ./list-mirrors.sh + +#bash option stop on first error +set -e + +#Include all user options and dependencies +git_mirrors_dir="$(dirname "${0}")" +. "${git_mirrors_dir}/config.sh" +. "${git_mirrors_dir}/lib/VERSION" +. "${git_mirrors_dir}/lib/functions.sh" + +PROGNAME="${0##*/}" +PROGVERSION="${VERSION}" + +STATUS=0 +pushd "${repo_dir}/${gitlab_namespace}" &> /dev/null +echo -n "Namespace: " 1>&2 +#red and bold combined +red_echo "$(bold_echo -n "${gitlab_namespace}")" 1>&2 +ls -1 "${repo_dir}/${gitlab_namespace}" | while read mirror;do + pushd "${mirror}" &> /dev/null + if git config --get svn-remote.svn.url &> /dev/null;then + repo="$(git config --get svn-remote.svn.url)" + else + repo="$(git config --get remote.origin.url)" + fi + green_echo -n "${mirror}" + echo -n " -> " + yellow_echo "${repo}" + popd &> /dev/null +done +popd &> /dev/null +