diff options
| author | Zach DeCook <zach.decook@bettercarpeople.com> | 2026-07-10 15:33:14 -0400 |
|---|---|---|
| committer | Zach DeCook <zach.decook@bettercarpeople.com> | 2026-07-10 15:33:14 -0400 |
| commit | 3374a3981538c0615ebfe36fc55a408f18d2bd17 (patch) | |
| tree | 63c58432ed9c7d4808e85ba897a4ed1d4dc7f0f2 | |
| parent | 0b980ed433dbc7262a6cf5d13689f1c67f3c98c4 (diff) | |
| download | dotfiles-3374a3981538c0615ebfe36fc55a408f18d2bd17.tar.gz | |
update jira-* scripts a little
| -rwxr-xr-x | .local/bin/jira-CR.php | 10 | ||||
| -rwxr-xr-x | .local/bin/jira-ticketstatus.php | 29 |
2 files changed, 30 insertions, 9 deletions
diff --git a/.local/bin/jira-CR.php b/.local/bin/jira-CR.php index ca87d55..6e665ea 100755 --- a/.local/bin/jira-CR.php +++ b/.local/bin/jira-CR.php @@ -64,8 +64,13 @@ function get_gh(string $repo, bool $cache = false): array { return json_decode(shell_exec("cat /tmp/prs_$repo.json"), true) ?? []; } +if (!empty($argv[1]) && $argv[1] != '--cached') { + echo "invalid argument\n"; + return 1; +} + $use_cache = false; -if ($argv[1] == "--cached") { +if (($argv[1] ?? 0) == "--cached") { $use_cache = true; } $prs_jsons = []; @@ -73,6 +78,7 @@ $prs_jsons[] = get_gh("OnBDC2", $use_cache); //$prs_jsons[] = get_gh("maple-ai"); $prs_jsons[] = get_gh("maple", $use_cache); +$padlen = 50; print(str_pad("\r", $padlen)); print("\r"); @@ -230,6 +236,7 @@ foreach ($has_no_pr as $ticket) { // Also show tickets which are past CR but no longer has two reviews $madeTitle = false; [$tickets, $ticketLabels] = get_jira(['Pending Demo', 'Ready To Test', 'Testing']); +echo "\n"; foreach ($prs_json as $pr) { [$terminal, $html] = process_pr($pr, $tickets, $ticketLabels, true); if (!empty($terminal) && !empty($html)) { @@ -244,6 +251,7 @@ foreach ($prs_json as $pr) { } } [$tickets, $ticketLabels] = get_jira(['Pending Sign Off', 'Signed Off']); +echo "\n"; foreach ($prs_json as $pr) { [$terminal, $html] = process_pr($pr, $tickets, $ticketLabels, true); if (!empty($terminal) && !empty($html)) { diff --git a/.local/bin/jira-ticketstatus.php b/.local/bin/jira-ticketstatus.php index 2a50751..04a26de 100755 --- a/.local/bin/jira-ticketstatus.php +++ b/.local/bin/jira-ticketstatus.php @@ -4,7 +4,7 @@ if (empty(trim($argv[1]))) { echo "Please paste the tickets as an argument"; exit(3); } -$tickets = array_unique(array_filter(explode(' ', strtr($argv[1], "\n\t\"", ' ')))); +$tickets = array_unique(array_filter(explode(' ', strtr($argv[1], "\n\t\"/", ' ')))); function rgb(int $r, int $g, int $b): string { $blacktext = "\033[38;2;0;0;0m"; @@ -21,19 +21,23 @@ function status_to_ansi(string $status): string { $ansireset = "\033[0m"; $ansibrightblue = "\033[94m"; // purple return match($status) { - "Blocked" => rgb(252, 229, 205), //$ansiyellow, #fce5cd + "Blocked" => rgb(240, 226, 209), //rgb(252, 229, 205), //$ansiyellow, #fce5cd "Ready To Work" => $ansireset, - "In Progress" => rgb(230, 184, 175), //$ansired, #e6b8af - "Code Review" => rgb(234, 209, 220), //$ansimagenta, #ead1dc + "In Progress" => rgb(233, 175, 165), //rgb(230, 184, 175), //$ansired, #e6b8af + "Code Review" => rgb(228, 129, 188), //rgb(234, 209, 220), //$ansimagenta, #ead1dc "Pending Demo", - "Ready To Test", "Testing" => rgb(217, 210, 233), //$ansibrightblue, #d9d2e9 + "Ready To Test", "Testing" => rgb(131, 90, 226), //rgb(217, 210, 233), //$ansibrightblue, #d9d2e9 "Pending Sign Off", "Signed Off", "Ready To Deploy", - "Obsolete", "Done" => rgb(207, 226, 243), // $ansiblue, #cfe2f3 + "Obsolete", "Done" => rgb(32, 143, 223), //rgb(207, 226, 243), // $ansiblue, #cfe2f3 default => $ansireset, }; } +function linkify(string $key): string { + return str_replace("LAMP-", "", $key); +} + //echo implode(' ', $tickets); //exit(1); $keys = implode(',', array_filter($tickets, fn($x) => str_starts_with($x, 'LAMP-'))); @@ -46,12 +50,21 @@ foreach ($jira_tickets as $jira_ticket) { [$key, $status] = explode("\t", $jira_ticket); $ticket_status[$key] = $status; $search[] = $key; - $replace[] = status_to_ansi($status) . $key . "\033[0m"; + $replace[] = status_to_ansi($status) . linkify($key); // $search_replace[$key] = } + +$search[] = "HOLIDAY"; +$replace[] = "\033[0m" . "HOLIDAY"; + +$search[] = "PTO"; +$replace[] = "\033[0m" . "PTO"; + +$search[] = " / "; +$replace[] = "\033[0m" . "/"; echo "\n"; echo str_replace($search, $replace, $argv[1]); -echo "\n"; +echo "\033[0m" . "\n"; return; |
