diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 21:42:14 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 21:43:51 +0200 |
commit | 6251d6ba1054cd79387f0f88ce25d2f4bc8b78c4 (patch) | |
tree | 03b8a7db0b97dcf50de4f2307b4f186e0203c278 /bin/common/gt | |
parent | 7be67a67ea8406e357f84693f02d86cc64fe077c (diff) |
checkpoint
Diffstat (limited to 'bin/common/gt')
-rwxr-xr-x | bin/common/gt | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/bin/common/gt b/bin/common/gt index 48321af..477adfc 100755 --- a/bin/common/gt +++ b/bin/common/gt @@ -6,6 +6,7 @@ # - git # - $EDITOR: -e # - parallel: optional, if installed will run the commands on all repos with parallel +# - gt-[cmd,st,sync] repos=$HOME/sync/share/git-track.txt # prevent file not found errors @@ -36,17 +37,6 @@ fetch() { done } -sync_status() { - if [ "$parallel" ]; then - parallel --colsep ' ' gt-sync {1} {2} <"$repos" - else - IFS=' ' - while read -r repo remote_url; do - gt-sync "$repo" "$remote_url" - done <"$repos" - fi -} - # no options if [ -z "$1" ]; then help @@ -55,7 +45,7 @@ fi [ "$(wc -l <"$repos")" -gt 0 ] || exit 0 -while getopts ":a:c:f:lsheuy" opt; do +while getopts ":a:c:f:lsheu" opt; do case "$opt" in a) if ! cd "$OPTARG" 2>/dev/null; then @@ -84,12 +74,18 @@ while getopts ":a:c:f:lsheuy" opt; do fi ;; s) cut -f 1 -d ' ' "$repos" | xargs -I{} gt-st {} ;; - y) sync_status ;; l) cut -f 1 -d ' ' "$repos" ;; e) $EDITOR "$repos" ;; f) repos="$OPTARG" ;; u) - sync_status | awk -F ':' '/x$/ {print $1}' | + if [ "$parallel" ]; then + parallel --colsep ' ' gt-sync {1} {2} <"$repos" + else + IFS=' ' + while read -r repo remote_url; do + gt-sync "$repo" "$remote_url" + done <"$repos" + fi | awk -F ':' '/x$/ {print $1}' | if [ "$parallel" ]; then parallel gt-cmd {} pull else |