zsh: split off functions now contain a note about use

This commit is contained in:
PowerUser64 2022-01-02 17:46:16 -08:00
parent 11ef75c22e
commit e8064cfac3
5 changed files with 11 additions and 6 deletions

View file

@ -1,4 +1,5 @@
#!/bin/bash
# Source this and then run `gloned`
# Git cLONE cD
# Can take extra arguments for git (ex: gloned url:/repo folder)
@ -7,13 +8,12 @@
gloned() {
# remove the url up to the last segment, and remove the .git from the end
REPO_DIR="${2:-"$(echo "${1%%.git}" | rev | cut -d '/' -f 1 | rev)"}"
REPO_DIR="${2:-"$(echo "${1%.git}" | rev | cut -d '/' -f 1 | rev)"}"
git clone "$1" "$REPO_DIR" || exit $?
ls
git clone "$1" "$REPO_DIR" || return $?
if ! cd "$REPO_DIR";then
echo 'Error: Could not `cd` into the repo'
exit 1
return 1
fi
echo
# ls --color=auto