about summary refs log tree commit diff stats
path: root/pkgs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-25 18:13:25 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-25 18:13:25 +0200
commitad9a652748a364565001a0aee0a20596526ba6d2 (patch)
tree8f52dd87667651057fd920a0460ad23219e84f70 /pkgs
parentfix(yambar): Correctly specify the `yambar-{cpu,memory}` binaries (diff)
downloadnixos-config-ad9a652748a364565001a0aee0a20596526ba6d2.tar.gz
nixos-config-ad9a652748a364565001a0aee0a20596526ba6d2.zip
chore(version): v1.38.0
Diffstat (limited to 'pkgs')
-rwxr-xr-xpkgs/by-name/gi/git-cleanup/git-cleanup.sh45
1 files changed, 20 insertions, 25 deletions
diff --git a/pkgs/by-name/gi/git-cleanup/git-cleanup.sh b/pkgs/by-name/gi/git-cleanup/git-cleanup.sh
index 1ab7bbd1..a6d8805a 100755
--- a/pkgs/by-name/gi/git-cleanup/git-cleanup.sh
+++ b/pkgs/by-name/gi/git-cleanup/git-cleanup.sh
@@ -4,7 +4,7 @@
 SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
 
 help() {
-    cat << EOF
+    cat <<EOF
 Automatically remove merged branches (remote and local)
 
 USAGE:
@@ -30,48 +30,43 @@ get_default_branch() {
 }
 
 cleanup() {
-    default_branch="$(get_default_branch)";
+    default_branch="$(get_default_branch)"
 
-    merged_branches="$(git branch --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)')";
+    merged_branches="$(git branch --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)')"
 
     [ "$merged_branches" ] && git branch --delete "$merged_branches"
 }
 cleanup_remote() {
-    default_branch="$(get_default_branch)";
+    default_branch="$(get_default_branch)"
 
-    merged_branches="$(git branch --remotes --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)' | sed 's|origin/||')";
+    merged_branches="$(git branch --remotes --merged "$default_branch" --no-contains "$default_branch" --format='%(refname:short)' | sed 's|origin/||')"
 
     [ "$merged_branches" ] && git push --delete origin "$merged_branches"
 }
 
-
-
-remote=false;
+remote=false
 for arg in "$@"; do
     case "$arg" in
-        "--help" | "-h")
-            help;
-            exit 0;
-            ;;
-       "--version" | "-v")
-            version;
-            exit 0;
-            ;;
-        "--remote" | "-r")
-            remote=true;
-            ;;
+    "--help" | "-h")
+        help
+        exit 0
+        ;;
+    "--version" | "-v")
+        version
+        exit 0
+        ;;
+    "--remote" | "-r")
+        remote=true
+        ;;
     esac
 done
 
-
-
-
 if [ "$remote" = "true" ]; then
-    cleanup_remote;
+    cleanup_remote
 elif [ "$remote" = "false" ]; then
-    cleanup;
+    cleanup
 else
-    die "BUG: 'remote' is not true or false but: '$remote'";
+    die "BUG: 'remote' is not true or false but: '$remote'"
 fi
 
 # vim: ft=sh