Skip to content

Commit

Permalink
various improvements. delete remote branch too
Browse files Browse the repository at this point in the history
  • Loading branch information
the-gigi committed Oct 31, 2024
1 parent d5fc9f8 commit 1194f63
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 29 deletions.
2 changes: 2 additions & 0 deletions bootstrap/brew-cask.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ bbedit
calibre
dropbox
firefox
google-cloud-sdk
iterm2
macdown
microsoft-git
microsoft-teams
paintbrush
pycharm-ce
rancher
Expand Down
49 changes: 22 additions & 27 deletions components/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,29 @@ function show_profiles {
# when you type its single digit number
#
# If there are 10 or more profiles you must press <enter> too
function aws_profile {
profiles=($(cat ~/.aws/config | rg '^.profile ' | cut -f 2 -d ' ' | cut -f 1 -d ']'))
if [[ $# == 1 ]]; then
found=0
for p in $profiles; do
if [[ $p == $1 ]]; then
found=1
break
fi
done
if [[ $found == 1 ]]; then
switch_profile $1
return
function aws_profile() {
profiles=($(rg -oP '(?<=\[profile ).*(?=\])' ~/.aws/config))
if [[ $# -eq 1 ]]; then
if [[ " ${profiles[@]} " =~ " $1 " ]]; then
switch_profile "$1"
return
fi
fi
fi

show_profiles $profiles

new_profile=""
while [[ $new_profile == "" ]]; do
echo "Choose a profile (1..${#profiles}):"
if (( ${#profiles} < 10 )); then
read -rs -k 1 answer
else
read -r answer
show_profiles "${profiles[@]}"
new_profile=""
while [[ -z $new_profile ]]; do
echo "Choose a profile (1..${#profiles[@]}):"
if (( ${#profiles} < 10 ))
then
read -sk 1 answer
else
read answer
fi
if ! [[ $answer =~ ^[0-9]+$ ]]; then
continue
fi
new_profile=$profiles[(($answer))]
done

switch_profile $new_profile
new_profile=$profiles[(($answer))]
done
switch_profile "$new_profile"
}
8 changes: 7 additions & 1 deletion components/git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ function git_delete_current_branch {
return 1
fi

# Delete the remote branch
if ! git push origin --delete "$current_branch"; then
echo "Failed to delete branch $current_branch remotely."
return 1
fi

# Optionally, rebase primary branch
echo "Rebasing $primary..."
# shellcheck disable=SC2086
Expand All @@ -159,4 +165,4 @@ function git_delete_current_branch {
echo "Branch $current_branch deleted and $primary rebased."
}

alias gbdd='get_git_delete_current_branch'
alias gbdd='git_delete_current_branch'
9 changes: 8 additions & 1 deletion rcfiles/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
syntax on

" Select delek color scheme
colorscheme evening
colorscheme evening

" Don't show line numbers
set nonumber

set expandtab " Use spaces instead of tabs
set tabstop=4 " Number of spaces that a <Tab> counts for
set shiftwidth=4 " Number of spaces to use for each step of (auto)indent
set softtabstop=4 " Number of spaces that a <Tab> counts for while editing

0 comments on commit 1194f63

Please sign in to comment.