20 lines
520 B
Bash
Executable File
20 lines
520 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
ls-git-folder() {
|
|
if [[ -z "$1" ]]; then
|
|
echo '$1/filter is empty.' >&2
|
|
return 1
|
|
fi
|
|
|
|
if [[ ! -f ".gitmodules" ]]; then
|
|
echo "Error: '.gitmodules' not found in current directory." >&2
|
|
return 1
|
|
fi
|
|
|
|
# Get submodule paths that start with filter, output space-separated
|
|
git config --file .gitmodules --get-regexp '^submodule\..*\.path$' 2>/dev/null \
|
|
| cut -d' ' -f2 \
|
|
| grep "^$1" \
|
|
| tr '\n' ' ' \
|
|
| sed 's/ $//'
|
|
} |