diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 21:48:56 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 21:48:56 +0200 |
commit | a857f247d9a71b88a4f0dbcfa95e3679e8456e70 (patch) | |
tree | 846ddcd8117be1505a970e3638fc65d0ec954a2e /bin/common/gt | |
parent | 75196520b3d6a0e60db1d03a64aaa0655cc4f202 (diff) | |
parent | 6251d6ba1054cd79387f0f88ce25d2f4bc8b78c4 (diff) |
Merge branch 'main' of debuc.com:dotfiles
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 |