@@ -82,11 +82,39 @@ function gsutil-download() {
8282 gsutil cp " ${gcloud_bag} " " ${download_dir} /${bag_name} "
8383}
8484
85+ function open-dill-pr() {
86+ txt=" ${1} "
87+ # Filter for the number directly after # (e.g., #1234)
88+ pr_num=$( echo " $txt " | rg -o ' #\d+' | head -n 1 | tr -d ' #' )
89+ repo=" ${2:- dill} "
90+ # Set url based on the repo, which could be roots or dill
91+ if [[ " ${repo} " = " dill" ]]; then
92+ url=" https://github.com/Pickle-Robot/dill/pull/"
93+ elif [[ " ${repo} " = " roots" ]]; then
94+ url=" https://github.com/Pickle-Robot/roots/pull/"
95+ fi
96+
97+ echo " Opening PR: ${url}${pr_num} "
98+ google-chrome " ${url}${pr_num} " & > /dev/null &
99+ }
100+
101+
102+ function open-dill-pr-from-clipboard() {
103+ # Open Dill PR in Google Chrome browser, where the PR number is obtained from the clipboard.
104+ #
105+ # Usage:
106+ # open_dill_pr_from_clipboard
107+ for issue in $( xclip -selection clipboard -o | ag -o ' #\d+' ) ; do
108+ open-dill-pr " ${issue} " " ${2:- dill} "
109+ done
110+
111+ }
85112# ######################################
86113# Key bindings
87114# ######################################
88115# Bind opening Pickle Jira issue
89116bindkey -s ' ^[i' ' open-pickle-jira-issue-from-clipboard^M'
117+ bindkey -s ' ^[d' ' open-dill-pr-from-clipboard^M'
90118
91119# ######################################
92120# Parse navigation inputs/output
0 commit comments