summaryrefslogtreecommitdiff
path: root/archive
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-11-13 10:06:48 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-11-13 10:06:48 -0700
commit9ff76e508325d49796e0130a1535f3a7985bfca6 (patch)
tree97b0dd8087748a53dc3d6c4f0fff24e12207df4e /archive
parentf45323a276a39a3f52a9eb491d965a1d34a1be22 (diff)
downloaddotfiles-9ff76e508325d49796e0130a1535f3a7985bfca6.tar.gz
archive clean-patch-queues
Diffstat (limited to 'archive')
-rwxr-xr-xarchive/bin/clean-patch-queues22
-rwxr-xr-xarchive/lib-src/tputfs.sh15
2 files changed, 37 insertions, 0 deletions
diff --git a/archive/bin/clean-patch-queues b/archive/bin/clean-patch-queues
new file mode 100755
index 00000000..7d2f9c21
--- /dev/null
+++ b/archive/bin/clean-patch-queues
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. "$HOME/.shenv"
+. "$HOME/src/dotfiles/lib-src/tputfs.sh"
+
+if [ ! "$1" = "-y" ]; then
+ status Are you sure you want to delete ALL git branches matching
+ status "patch-queue/* in all git repos matching ~/src/* ?"
+ status Press enter to confirm or hit C-c to abort
+ read _
+fi
+
+for repo in $HOME/src/*; do
+ if [ -d "$repo/.git" ]; then
+ cd "$repo"
+ branches="$(git branch | grep ' patch-queue/*' | cut -c3-)"
+ for branch in $branches; do
+ git branch -D "$branch"
+ echo " in repo $(basename $repo)"
+ done
+ fi
+done
diff --git a/archive/lib-src/tputfs.sh b/archive/lib-src/tputfs.sh
new file mode 100755
index 00000000..ab3c3c3a
--- /dev/null
+++ b/archive/lib-src/tputfs.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# shell scripting functions using tput
+
+status ()
+{
+ echo -n "["
+ test "$TERM" = "dumb" || tput setaf 3
+ echo -n $(basename $0)
+ test "$TERM" = "dumb" || tput setaf 7
+ echo -n "] "
+ test "$TERM" = "dumb" || tput bold
+ echo $@
+ test "$TERM" = "dumb" || tput sgr0
+}