summary refs log tree commit diff
path: root/.local/bin/jira-CR.php
diff options
context:
space:
mode:
authorZach DeCook <zach.decook@bettercarpeople.com>2026-06-26 08:48:04 -0400
committerZach DeCook <zach.decook@bettercarpeople.com>2026-06-26 08:48:04 -0400
commita72093689622ca60d00a3a5aaf4cd8a6d53dd477 (patch)
tree440b4ecba2cf780cb46478724d3bdcfa51c481ab /.local/bin/jira-CR.php
parentc1fd498db1b50c89064101ac7d863ed1a150bba4 (diff)
downloaddotfiles-a72093689622ca60d00a3a5aaf4cd8a6d53dd477.tar.gz
function for getting jira tickets
Diffstat (limited to '.local/bin/jira-CR.php')
-rwxr-xr-x.local/bin/jira-CR.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/.local/bin/jira-CR.php b/.local/bin/jira-CR.php
index bcbe873..7b62343 100755
--- a/.local/bin/jira-CR.php
+++ b/.local/bin/jira-CR.php
@@ -13,14 +13,19 @@ if (!function_exists('array_any')) {
     }
 }
 
-$padlen = 50;
-print(str_pad("\rGetting tickets from jira...", $padlen));
-$ticket_lines = explode("\n", rtrim(shell_exec("jira-cli issues list -q'project IS NOT EMPTY and project != AUTO and project != NET and project != MSP and project != SYST and project != LOYAL and Sprint in openSprints()' --order-by='Sprint' -s'Code Review' --columns=KEY,LABELS --plain | grep -v '^KEY\b'")));
-$tickets = array_map(fn($x) => explode("\t", $x)[0], $ticket_lines);
-$ticketLabels = array_combine(
-    $tickets,
-    array_map(fn($x) => explode(',', explode("\t", $x)[1] ?? ''), $ticket_lines)
-);
+function get_jira(array $statuses): array {
+    $padlen = 50;
+    print(str_pad("\rGetting tickets from jira...", $padlen));
+    $statuses = implode(' ', array_map(fn($x)=>"-s'$x'", $statuses));
+    $ticket_lines = explode("\n", rtrim(shell_exec("jira-cli issues list -q'project IS NOT EMPTY and project != AUTO and project != NET and project != MSP and project != SYST and project != LOYAL and Sprint in openSprints()' --order-by='Sprint' $statuses --columns=KEY,LABELS --plain | grep -v '^KEY\b'")));
+    $tickets = array_map(fn($x) => explode("\t", $x)[0], $ticket_lines);
+    $ticketLabels = array_combine(
+        $tickets,
+        array_map(fn($x) => explode(',', explode("\t", $x)[1] ?? ''), $ticket_lines)
+    );
+    return [$tickets, $ticketLabels];
+}
+[$tickets, $ticketLabels] = get_jira(['Code Review']);
 
 
 function get_gh(string $repo): array {