Created
April 4, 2022 19:23
-
-
Save salmin89/09b8b128ab9e7db15d3f7db9d9c7804b to your computer and use it in GitHub Desktop.
shell scripts to perform commands on multiple repos at once
This file contains hidden or 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
#usage oa -p /proj1/ -p /proj2/ git checkout master | |
while getopts "p:" flag; do | |
case $flag in | |
p) paths+=("$OPTARG");; | |
*) echo "Unexpected option ${flag}"; exit 1;; | |
esac | |
done | |
shift $(expr $OPTIND - 1 ) | |
for path in "${paths[@]}"; do | |
( cd $path && $@) | |
done |
This file contains hidden or 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
#usage: oo git checkout master | |
#set your root dirr to all your repos | |
ROOT="$HOME/src" | |
#set you vscode workspace file | |
WORKSPACE_CONFIG="$ROOT/src.code-workspace" | |
# grab current config file | strip commented lines | jq to grab the paths | |
paths=($(cat $WORKSPACE_CONFIG | sed 's/\/\/.*//' | jq -r '.folders[].path' )) | |
#exec on all open | |
for path in "${paths[@]}"; do | |
echo ">>>$path<<<" | |
( cd "$ROOT/$path" && $@) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment