Last active
September 11, 2017 18:49
-
-
Save snazzware/bc1563afc7e35d2e944551a7824a634e to your computer and use it in GitHub Desktop.
bitbar script to show current branch and link to JIRA on click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$icon = "iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAMAAABV0m3JAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAADMUExURQAAAP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////zqS4QgAAABDdFJOUwAMcP4BtovQmPfvuQp4jPhKpz8J3IgizLorcW/DqWFMwv2Nreg62rDxqKvIFH0m4dmzvhZP9nRyduVEtaKDgd7t3U1csWsHAAAAkklEQVQI12WO1RLDMAwElcR26jCVmZmZQf//T3U6acfT7It0+3ASgOK78w0keHfuK2KyXjB19QR+CxaOkKYDFv5QgJlClg27LxLNxByXtqEKSdRKtdbE1qdzNmyUyPdAHguQgqKellnUPCC7cbsoyRxHbUUf+1HHkmx9ID5gEGJXLlgfzlF0um4nf8XhhT9f8fIGD/4Po42ajUIAAAAASUVORK5CYII="; | |
chdir('/Users/jmc/projects/dash-management'); | |
$output = []; | |
exec('git status', $output); | |
$toks = explode(' ',reset($output)); | |
$branch = $toks[2]; | |
$toks = explode('/',$branch); | |
$folder = isset($toks[0]) ? $toks[0] : ''; | |
$branch = isset($toks[1]) ? $toks[1] : ''; | |
if (strlen(trim($branch))>0) { | |
$color = '99CD4C'; | |
} else { | |
$color = '922D25'; | |
} | |
$branchToks = explode('-',$branch); | |
if (strpos(strtolower($branch),'-sprint-') !== false) { | |
$url = "https://amerch.atlassian.net/secure/RapidBoard.jspa?rapidView=14&projectKey={$branchToks[0]}"; | |
} else { | |
$url = "https://amerch.atlassian.net/browse/{$branch}"; | |
} | |
echo "{$folder}/{$branch} | color=#{$color} size=12 href={$url} templateImage={$icon}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment