Update git take command

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
Marcus Noble 2021-12-03 18:42:46 +00:00
parent 0b43014820
commit 21dc2e7a00
Signed by: AverageMarcus
GPG Key ID: B8F2DB8A7AEBAF78

View File

@ -45,8 +45,19 @@ lt() {
git() { git() {
if [ "$1" = "take" ]; then # Git clone then cd into new directory if [ "$1" = "take" ]; then # Git clone then cd into new directory
_git clone $2 if [ $# -gt 2 ]; then
cd $(basename -s .git $2) _git clone ${@:2}
cd $3
else
ORG=$(echo $2 | sed -e 's|https://||' -e 's|/| |g' -e 's|:| |g' | cut -f 2 -d ' ')
REPO=$(echo $2 | sed -e 's|https://||' -e 's|/| |g' -e 's|:| |g' | cut -f 3 -d ' ' | xargs basename -s .git)
DST="${HOME}/Code/${ORG}/${REPO}"
mkdir -p ${DST}
_git clone $2 ${DST}
cd ${DST}
fi
elif [ "$1" = "commit" ]; then # Sign all commits elif [ "$1" = "commit" ]; then # Sign all commits
shift shift
_git commit -s $@ _git commit -s $@