|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
#!/usr/bin/env bash |
|
|
|
|
# cd to git repos, and start a subshell in that directory. |
|
|
|
|
# Written by skiqqy with love. |
|
|
|
|
# Usage: goto -h |
|
|
|
|
# Usage: goto PATTERN |
|
|
|
|
|
|
|
|
|
usage() |
|
|
|
|
{ |
|
|
|
@ -44,7 +44,7 @@ main() |
|
|
|
|
|
|
|
|
|
[ -z "$1" ] && usage 1 |
|
|
|
|
|
|
|
|
|
mapfile dirs < <(find . -regex ".*$1.*\.git" 2> /dev/null | sed -E 's|(.*)/\.git|\1|g') |
|
|
|
|
mapfile -t dirs < <(find . -type d 2> /dev/null | grep -E "^.*/$1/\.git$" | sed -E 's|(.*)/\.git|\1|g') |
|
|
|
|
|
|
|
|
|
if "$all" && [ "${#dirs[@]}" -gt 1 ] |
|
|
|
|
then |
|
|
|
@ -61,7 +61,7 @@ main() |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
[ -d "$dir" ] && cd "$dir" || exit 1 |
|
|
|
|
cd "$dir" || exit 1 |
|
|
|
|
$shell # Start the subshell |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|