Last active
May 30, 2024 21:53
-
-
Save laceysanderson/47b3c305088ad5cc8749e90febfb9539 to your computer and use it in GitHub Desktop.
Provides the git commands for cloning the repos I work with most.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## Helps with managing dockers for coding and review. | |
## | |
repoKey=$1 | |
issueNum=$2 | |
shortDescrip=$3 | |
branch=$4 | |
green=$(tput setaf 2) | |
normal=$(tput sgr0) | |
## Set Variables + commands based on repo key | |
case $repoKey in | |
tripal) | |
cloneURL="https://github.com/tripal/tripal" | |
dirName="trpCore-$issueNum-$shortDescrip" | |
;; | |
base) | |
cloneURL="https://github.com/TripalCultivate/TripalCultivate" | |
dirName="trpcultBase-$issueNum-$shortDescrip" | |
;; | |
pheno) | |
cloneURL="https://github.com/TripalCultivate/TripalCultivate-Phenotypes" | |
dirName="trpcultPheno-$issueNum-$shortDescrip" | |
;; | |
geno) | |
cloneURL="https://github.com/TripalCultivate/TripalCultivate-Genetics" | |
dirName="trpcultGeno-$issueNum-$shortDescrip" | |
;; | |
germ) | |
cloneURL="https://github.com/TripalCultivate/TripalCultivate-Germplasm" | |
dirName="trpcultGerm-$issueNum-$shortDescrip" | |
;; | |
ecosystem) | |
cloneURL="https://github.com/TripalCultivate/TripalCultivate-Ecosystem" | |
dirName="trpcultEcosystem-$issueNum-$shortDescrip" | |
;; | |
theme) | |
cloneURL="https://github.com/TripalCultivate/TripalCultivate-Theme" | |
dirName="trpcultTheme-$issueNum-$shortDescrip" | |
;; | |
*) | |
echo "" | |
echo "${green}cloner.sh [repoKey] [issueNum] [shortDescrip] [branch]${normal}" | |
echo -e "\twhere [repoKey] is one of 'tripal', 'base', 'pheno', 'geno', 'germ', 'ecosystem', 'theme'" | |
echo -e "\t [issueNum] is the issue the branch is associated with" | |
echo -e "\t [shortDescrip] is a short description using snake case with no spaces" | |
echo -e "\t [branch] is the branch to checkout once the repo is cloned" | |
exit 0 | |
;; | |
esac | |
## | |
## | |
## Now we need to actually do something ;-) | |
## | |
## | |
## First we clone the repository. | |
cmd="git clone $cloneURL $dirName" | |
echo "${green}$cmd${normal}" | |
echo "" | |
$cmd | |
echo "" | |
## Then we move into the directory. | |
cmd="cd $dirName" | |
echo "${green}$cmd${normal}" | |
echo "" | |
$cmd | |
echo "" | |
## Finally we checkout the branch. | |
cmd="git checkout $branch" | |
echo "${green}$cmd${normal}" | |
echo "" | |
$cmd | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment