From fa004d3de13f8e8f46a3375fb4da12936a623209 Mon Sep 17 00:00:00 2001
From: Timmy Keller <tjk@tjkeller.xyz>
Date: Fri, 22 Oct 2021 17:17:49 -0500
Subject: memory usage and launch script and pdflatex script

---
 sync/griff | 84 ++++++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 49 insertions(+), 35 deletions(-)

(limited to 'sync/griff')

diff --git a/sync/griff b/sync/griff
index 79b55de..bc43b7c 100755
--- a/sync/griff
+++ b/sync/griff
@@ -1,12 +1,12 @@
 #!/bin/sh
 home=$(echo $HOME | sed 's/\//\\\//g')
 repos="$(grep -v '#' | sed "s/\~/$home/")" << REPOS
-blr|~/.local/src/programs/blr
-dmenu|~/.local/src/programs/dmenu
-dotconfig|~/.config
-scripts|~/.local/bin
-st|~/.local/src/programs/st
-timmywm|~/.local/src/programs/timmywm
+#~/.local/src/programs/blr
+~/.local/src/programs/dmenu
+~/.config
+~/.local/bin
+~/.local/src/programs/st
+~/.local/src/programs/timmywm
 REPOS
 #echo "$repos" | cut -f1
 
@@ -18,34 +18,48 @@ RED="\033[0;31m"
 GRN="\033[0;32m"
 MAG="\033[0;35m"
 
-for repo in $repos; do
-	name=$(echo $repo | cut -d'|' -f1)
-	dir=$(echo $repo | cut -d'|' -f2)
-	if cd $dir 2>/dev/null; then
-		if git diff --quiet HEAD $REF -- $DIR; then
-			echo "$GRN[Repo $name is unchanged!]$NORM"
+me() { echo $0 | sed 's/.*\///'; }
+repocheck() { [ -z "$repos" ] && echo "No repos have been added!\nUse \"$(me) add\" or edit the script file to add a new repo!" && exit; }
+
+reponame() { sed -n 's/^\s*url.*\/\(.*\)\.git/\1/p' $1/.git/config; }
+
+rddiff() {
+	repocheck
+	for repo in $repos; do
+		name="$(reponame $repo)"
+		if cd $repo 2>/dev/null; then
+			if git diff --quiet HEAD $REF -- $DIR; then
+				echo "$GRN[Repo $name is unchanged!]$NORM"
+			else
+				echo "$CYN[Repo $name has changed:]$NORM"
+				git status | grep -v '(use'
+				read -p "Would you like to view the changes? [y/n]: " viewchange
+				case $viewchange in
+					y|yes|Y|Yes)
+						git diff HEAD $REF -- $DIR
+					;;
+				esac
+				read -p "Would you like to push these changes? [y/n]: " pushchange
+				case $pushchange in
+					y|yes|Y|Yes)
+						while [ -z "$commitmsg" ]; do
+							read -p "Enter a commit message: " commitmsg
+						done
+						git add . && git commit -m "$commitmsg" && git push \
+							&& echo "$GRN[Changes to repo $name successfully pushed!]$NORM" \
+							|| echo "$RED[An error occured while pushing changes to repo $name!]$NORM"
+					;;
+				esac
+			fi
 		else
-			echo "$CYN[Repo $name has changed:]$NORM"
-			git status | grep -v '(use'
-			read -p "Would you like to view the changes? [y/n]: " viewchange
-			case $viewchange in
-				y|yes|Y|Yes)
-					git diff HEAD $REF -- $DIR
-				;;
-			esac
-			read -p "Would you like to push these changes? [y/n]: " pushchange
-			case $pushchange in
-				y|yes|Y|Yes)
-					while [ -z "$commitmsg" ]; do
-						read -p "Enter a commit message: " commitmsg
-					done
-					git add . && git commit -m "$commitmsg" && git push \
-						&& echo "$GRN[Changes to repo $name successfully pushed!]$NORM" \
-						|| echo "$RED[An error occured while pushing changes to repo $name!]$NORM"
-				;;
-			esac
+			echo "$BOLD$RED[Repo $name does not exist at $repo!]$NORM"
 		fi
-	else
-		echo "$BOLD$RED[Repo $name does not exist at $dir!]$NORM"
-	fi
-done
+	done
+}
+
+drdiff() { echo impl; }
+
+case $1 in
+	add) echo "add this in" ;;
+	*)	rddiff	;;
+esac
-- 
cgit v1.2.3