Skip to content

Instantly share code, notes, and snippets.

@kuahyeow
Forked from ezza/.bashrc
Created December 3, 2012 20:39
Show Gist options
  • Save kuahyeow/4197842 to your computer and use it in GitHub Desktop.
Save kuahyeow/4197842 to your computer and use it in GitHub Desktop.
Returns the title of the beetil your branch is on
export beetil_api_key=YOUR_BEETIL_API_KEY_HERE
# extracts the branch name
function plain_git_branch {
git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///'
}
# extracts the part of the branch name that could be a beetil number
function beetil_number_from_git_branch {
plain_git_branch 2> /dev/null | cut -c2-9
}
function beetil {
curl -s "https://x:$beetil_api_key@api.gotoassist.com/desk/external_api/v1/changes/$(beetil_number_from_git_branch)" | grep -Po '"title":.*?[^\\]"[,}]'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment