summaryrefslogtreecommitdiff
path: root/.old/sync/griff
diff options
context:
space:
mode:
Diffstat (limited to '.old/sync/griff')
-rwxr-xr-x.old/sync/griff64
1 files changed, 64 insertions, 0 deletions
diff --git a/.old/sync/griff b/.old/sync/griff
new file mode 100755
index 0000000..549b108
--- /dev/null
+++ b/.old/sync/griff
@@ -0,0 +1,64 @@
+#!/bin/sh
+home=$(echo $HOME | sed 's/\//\\\//g')
+repos="$(grep -v '#' | sed "s/\~/$home/")" << REPOS
+#~/.local/src/programs/blr
+~/.local/src/programs/dmenu
+~/.config
+~/.local/bin
+~/.local/src/programs/st
+~/.local/src/programs/timmywm
+REPOS
+#echo "$repos" | cut -f1
+
+# Colors
+BOLD="\033[1m"
+NORM="\033[0m"
+CYN="\033[0;36m"
+RED="\033[0;31m"
+GRN="\033[0;32m"
+MAG="\033[0;35m"
+
+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"
+ commitmsg=""
+ ;;
+ esac
+ fi
+ else
+ echo "$BOLD$RED[Repo $name does not exist at $dir!]$NORM"
+ fi
+ done
+}
+
+drdiff() { echo impl; }
+
+case $1 in
+ add) echo "add this in" ;;
+ *) rddiff ;;
+esac