From b93f16c3138583def4bda86993de54705032197c Mon Sep 17 00:00:00 2001 From: Graham Hall Date: Wed, 16 Apr 2025 10:00:00 -0400 Subject: [PATCH] 2025-04-16 --- scripts/git-commit-push.sh | 33 +++++++++++++++++++++++++++------ scripts/open-in-ghostty.sh | 0 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 scripts/open-in-ghostty.sh diff --git a/scripts/git-commit-push.sh b/scripts/git-commit-push.sh index 9c5d68b..d9686e8 100755 --- a/scripts/git-commit-push.sh +++ b/scripts/git-commit-push.sh @@ -1,11 +1,32 @@ #!/bin/bash -git add -A COMMIT_MSG=$(gum input --placeholder "Commit message...") -git commit -m "$COMMIT_MSG" -BRANCH=$(git name-rev --name-only HEAD) -gum confirm "Push?" && git push origin $BRANCH -if [ "${!#}" == "-pr" ]; then - gh pr create --base beta +if [ -z "$COMMIT_MSG"]; then + echo "Commit cancelled..." + exit 1 +fi + +git add -A +git commit -m "$COMMIT_MSG" + +BRANCH=$(git name-rev --name-only HEAD) +gum confirm "Push?" && git push origin $BRANCH + +CREATE_PR=$(gum confirm "Create PR?") + +if [ "${!#}" == "-pr" && CREATE_PR == 0 ]; then + REMOTE_BRANCHES=$(git branch -r | grep -v '\//' | sed 's/origin\///') + + if echo "$remote_branches" | grep -q "^beta$"; then + PR_BASE="beta" + elif echo "$remote_branches" | grep -q "^main$"; then + PR_BASE="main" + elif echo "$remote_branches" | grep -q "^master$"; then + PR_BASE="master" + else + PR_BASE=$(REMOTE_BRANCHES | gum choose --limit 1 ) + fi + + gh pr create --base PR_BASE fi diff --git a/scripts/open-in-ghostty.sh b/scripts/open-in-ghostty.sh new file mode 100644 index 0000000..e69de29