Skip to content

Instantly share code, notes, and snippets.

@luizcarvalho
Last active September 15, 2023 13:45
Show Gist options
  • Save luizcarvalho/f1d01f2a07e54a4a4b13b830a8121ff5 to your computer and use it in GitHub Desktop.
Save luizcarvalho/f1d01f2a07e54a4a4b13b830a8121ff5 to your computer and use it in GitHub Desktop.
Script to open or create issue in Gitlab using fish shell for WSL
function open_issue
set DISPLAY :0
set BROWSER /usr/bin/wslview
set -g ISSUE_ID (git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/[^0-9]*//g')
set -g PROJECT_NAME (basename $PWD)
set -g GITLAB_BASE_URL https://gitlab.com
if test $ISSUE_ID
# echo (git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/')
echo "⚡ Opening issue $ISSUE_ID "
sensible-browser "$GITLAB_BASE_URL/$PROJECT_NAME/-/issues/$ISSUE_ID"
else
sensible-browser "$GITLAB_BASE_URL/$PROJECT_NAME/-/issues/new?issuable_template=feature"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment