dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 10015f0ffc1c0c319f00034a98d391cc48ca7722
parent 72e0815c0281172d4992d5b89ff7394735827245
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Tue, 26 Feb 2019 18:16:29 +0100

Script to find all user git repos

Searches the home directory tree for any git repositories, fetches them,
and outputs status into a temp file that's opened in vim.


Former-commit-id: c9d94401e5a3246364633917572cdcedcfe5f25b
Diffstat:
Ascripts/global-git-status | 45+++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+), 0 deletions(-)

diff --git a/scripts/global-git-status b/scripts/global-git-status @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +spin() { + sp='/-\|' + printf ' ' + while true; do + # Print backspace, field of width 1 + printf '\b%.1s' "$sp" + + # Move first character to end + sp=${sp#?}${sp%???} + sleep 0.05 + done +} +hr() { for ((i=0; i<$(tput cols); i++)); do echo -n "#"; done; echo; } + +spin & +pid=$! + +trap "kill $pid" INT +echo "Looking for git repositories..." +logfile="$(mktemp)" +gits=$(find "$HOME" -name ".git" -not -path "*vim*plugged*") + +kill $pid &> /dev/null +trap - INT +count=0 +echo -ne '\r' + +IFS=$'\n' +for i in ${gits[@]}; do + ((count++)) + # unset IFS + echo -ne "Processed $count\r" + # IFS=$'\n' + echo "git: $i" >> $logfile; + cd "$i/../" &>/dev/null; + git f &> /dev/null; + git status >> $logfile; + hr >> $logfile; +done +echo +vim $logfile -c "g/nothing to commit, working tree clean/norm V?git: ddd" -c "w | 1" +unset IFS +clear+ \ No newline at end of file