Skip to content

Instantly share code, notes, and snippets.

@stevenliebregt
Last active March 16, 2020 14:12
Show Gist options
  • Save stevenliebregt/0f0558ce0e7a788b17f13effd19ae9e3 to your computer and use it in GitHub Desktop.
Save stevenliebregt/0f0558ce0e7a788b17f13effd19ae9e3 to your computer and use it in GitHub Desktop.
Clone All RawNeal because I am lazy
CLONE_METHOD=${1:-ssh}
BASE_CLONE_COMMAND="git clone"
REPO_OWNER=Cdalmaij
declare -a REPOS=(
"Proof_Of_Concept"
"Backend"
"Frontend_Hybrid"
"Frontend_Browser"
"Architecture_Models"
)
fix_shitty_repo_name() {
OUTPUT=$(sed --expression 's/\([A-Z]\)/-\L\1/g' --expression 's/^-//' <<< "$1")
echo "${OUTPUT//_}"
}
make_clone_command() {
if [ $CLONE_METHOD = "ssh" ]; then
BASE_CLONE_COMMAND="$BASE_CLONE_COMMAND git@github.com:"
elif [ $CLONE_METHOD = "https" ]; then
BASE_CLONE_COMMAND="$BASE_CLONE_COMMAND https://github.com/"
fi
echo "$BASE_CLONE_COMMAND$REPO_OWNER/"
}
clone() {
for repo in "${REPOS[@]}"
do
SHITTY_REPO_NAME=Rawneal_$repo
NON_SHITTY_REPO_NAME=$(fix_shitty_repo_name $SHITTY_REPO_NAME)
CLONE_COMMAND="$1$SHITTY_REPO_NAME $NON_SHITTY_REPO_NAME"
$CLONE_COMMAND
done
}
echo "Howdy!"
mkdir -p rawneal
cd rawneal
clone "`make_clone_command`"
echo "Bye bye!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment